@@ -53,7 +53,7 @@ def verify(part, index):
5353 try :
5454 verify (state .student_parts [name ], index )
5555 except (KeyError , IndexError ):
56- state .do_test ( Test ( Feedback (_msg , state ) ))
56+ state .report ( Feedback (_msg , state ))
5757
5858 return state
5959
@@ -101,7 +101,7 @@ def shout(word):
101101
102102 if d ["stu_len" ] != d ["sol_len" ]:
103103 _msg = state .build_message (unequal_msg , d )
104- state .do_test ( Test ( Feedback (_msg , state ) ))
104+ state .report ( Feedback (_msg , state ))
105105
106106 return state
107107
@@ -195,7 +195,7 @@ def parse_tree(tree):
195195 if exact and not code :
196196 state .do_test (EqualTest (stu_rep , sol_rep , Feedback (_msg , state )))
197197 elif not sol_rep in stu_rep :
198- state .do_test ( Test ( Feedback (_msg , state ) ))
198+ state .report ( Feedback (_msg , state ))
199199
200200 return state
201201
@@ -348,12 +348,12 @@ def has_expr(
348348 fmt_kwargs ["stu_str" ] = str_stu
349349 _msg = state .build_message (error_msg , fmt_kwargs , append = append )
350350 feedback = Feedback (_msg , state )
351- state .do_test ( Test ( feedback ) )
351+ state .report ( feedback )
352352
353353 # name is undefined after running expression
354354 if isinstance (eval_stu , UndefinedValue ):
355355 _msg = state .build_message (undefined_msg , fmt_kwargs , append = append )
356- state .do_test ( Test ( Feedback (_msg , state ) ))
356+ state .report ( Feedback (_msg , state ))
357357
358358 # test equality of results
359359 _msg = state .build_message (incorrect_msg , fmt_kwargs , append = append )
@@ -449,7 +449,9 @@ def has_code(state, text, pattern=True, not_typed_msg=None):
449449 student_code = state .student_code
450450
451451 _msg = state .build_message (not_typed_msg )
452- state .do_test (StringContainsTest (student_code , text , pattern , Feedback (_msg , state )))
452+ state .do_test (
453+ StringContainsTest (student_code , text , pattern , Feedback (_msg , state ))
454+ )
453455
454456 return state
455457
@@ -660,7 +662,9 @@ def has_printout(
660662 )
661663
662664 try :
663- sol_call_ast = state .ast_dispatcher ("function_calls" , state .solution_ast )["print" ][index ]["node" ]
665+ sol_call_ast = state .ast_dispatcher ("function_calls" , state .solution_ast )[
666+ "print"
667+ ][index ]["node" ]
664668 except (KeyError , IndexError ):
665669 raise InstructorError (
666670 "`has_printout({})` couldn't find the {} print call in your solution." .format (
@@ -748,8 +752,10 @@ def has_no_error(
748752 state .assert_root ("has_no_error" )
749753
750754 if state .reporter .errors :
751- _msg = state .build_message (incorrect_msg , {"error" : str (state .reporter .errors [0 ])})
752- state .do_test (Test (Feedback (_msg , state )))
755+ _msg = state .build_message (
756+ incorrect_msg , {"error" : str (state .reporter .errors [0 ])}
757+ )
758+ state .report (Feedback (_msg , state ))
753759
754760 return state
755761
0 commit comments