Why do_exec = True when using has_equal_output?
filipsch opened this issue · 0 comments
filipsch commented
It does not work in all cases, and I don't understand why yet. Something to look into
>>> from pythonwhat.local import setup_state
>>> s = setup_state(stu_code = 'print(1 + 2)', sol_code = 'print(2 + 3)')
>>> s.has_equal_output()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/filip/workspace/pythonwhat/pythonwhat/check_syntax.py", line 63, in __call__
self._state = self._crnt_sct(state=self._state, *args, **kwargs)
File "/Users/filip/workspace/pythonwhat/pythonwhat/check_funcs.py", line 753, in has_expr
rep.do_test(EqualTest(eval_stu, eval_sol, Feedback(_msg, state), func))
File "/Users/filip/workspace/pythonwhat/pythonwhat/Reporter.py", line 36, in do_test
raise TestFail(feedback, self.build_failed_payload(feedback))
pythonwhat.Test.TestFail: Unexpected expression output: expected `5`, got `3`.
>>> s.check_function('print').has_equal_output()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/filip/workspace/pythonwhat/pythonwhat/check_syntax.py", line 63, in __call__
self._state = self._crnt_sct(state=self._state, *args, **kwargs)
File "/Users/filip/workspace/pythonwhat/pythonwhat/check_funcs.py", line 723, in has_expr
"Error: {} - {}".format(type(str_sol), str_sol))
ValueError: Evaluating expression raised error in solution process (or not an error if testing for one). Error: <class 'TypeError'> - expected Module node, got Call