@@ -358,6 +358,7 @@ def call(args,
358358 error_msg = MSG_CALL_ERROR ,
359359 # TODO kept for backwards compatibility in test_function_definition/lambda
360360 argstr = '' ,
361+ func = None ,
361362 state = None , ** kwargs ):
362363 rep = Reporter .active_reporter
363364 test_type = ('value' , 'output' , 'error' )
@@ -389,7 +390,7 @@ def call(args,
389390
390391 # incorrect result
391392 _msg = state .build_message (incorrect_msg , fmt_kwargs )
392- rep .do_test (EqualTest (eval_sol , eval_stu , Feedback (_msg , stu_node )))
393+ rep .do_test (EqualTest (eval_sol , eval_stu , Feedback (_msg , stu_node ), func ))
393394
394395 return state
395396
@@ -452,6 +453,7 @@ def has_expr(incorrect_msg="__JINJA__:Unexpected expression {{test}}: expected `
452453 name = None ,
453454 highlight = None ,
454455 copy = True ,
456+ func = None ,
455457 state = None ,
456458 test = None ):
457459 """Run student and solution code, compare returned value, printed output, or errors.
@@ -483,6 +485,7 @@ def has_expr(incorrect_msg="__JINJA__:Unexpected expression {{test}}: expected `
483485 student and solution code. This could be thought of as post code.
484486 copy (bool): whether to try to deep copy objects in the environment, such as lists, that could
485487 accidentally be mutated. Disable to speed up SCTs. Disabling may lead to cryptic mutation issues.
488+ func: custom binary function of form f(stu_result, sol_result), for equality testing.
486489 """
487490 rep = Reporter .active_reporter
488491
@@ -537,7 +540,7 @@ def has_expr(incorrect_msg="__JINJA__:Unexpected expression {{test}}: expected `
537540
538541 # test equality of results
539542 _msg = state .build_message (incorrect_msg , fmt_kwargs )
540- rep .do_test (EqualTest (eval_stu , eval_sol , Feedback (_msg , highlight )))
543+ rep .do_test (EqualTest (eval_stu , eval_sol , Feedback (_msg , highlight ), func ))
541544
542545 return state
543546
0 commit comments