File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -520,3 +520,22 @@ def test_function_call_in_comparison(code):
520520 sct = "Ex().check_function('len')"
521521 res = helper .run ({"DC_CODE" : code , "DC_SOLUTION" : code , "DC_SCT" : sct })
522522 assert res ["correct" ]
523+
524+
525+ def test_ho_function ():
526+ # TODO: FunctionParser.visit_Call should append something to name to discern HOF calls
527+ # e.g. () if node.func is Func (this should only affect limited exercises)
528+ sct = "Ex().check_function('hof').check_args(0).has_equal_value(override=2)"
529+
530+ code = """
531+ def hof(arg1):
532+ def inner(arg2):
533+ return arg1, arg2
534+
535+ return inner
536+
537+ hof(1)(2)
538+ """
539+
540+ res = helper .run ({"DC_CODE" : code , "DC_SOLUTION" : code , "DC_SCT" : sct })
541+ assert res ["correct" ]
You can’t perform that action at this time.
0 commit comments