I am just starting to experiment with nbgrader, so please take my apology if this issue is something that can be done already or inconsistent with the nbgrader workflow.
I wonder it it might be possible to assure that when you validate or autograde the python code is run with the stdout redirected, so that statements like print do not just print, but also save their output into some string that can be used in the assertions in hidden tests.