diff options
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/evaluator_tests/test_python_evaluation.py | 5 | ||||
-rw-r--r-- | yaksh/python_assertion_evaluator.py | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/yaksh/evaluator_tests/test_python_evaluation.py b/yaksh/evaluator_tests/test_python_evaluation.py index 2305f3b..1087c5d 100644 --- a/yaksh/evaluator_tests/test_python_evaluation.py +++ b/yaksh/evaluator_tests/test_python_evaluation.py @@ -208,6 +208,8 @@ class PythonAssertionEvaluationTestCases(unittest.TestCase): self.assertTrue(result.get('success')) def test_single_testcase_error(self): + """ Tests the user answer with just an incorrect test case """ + user_answer = "def palindrome(a):\n\treturn a == a[::-1]" test_case_data = [{"test_case": 's="abbb"\nasert palindrome(s)==False'} ] @@ -233,6 +235,9 @@ class PythonAssertionEvaluationTestCases(unittest.TestCase): def test_multiple_testcase_error(self): + """ Tests the user answer with an correct test case + first and then with an incorrect test case """ + user_answer = "def palindrome(a):\n\treturn a == a[::-1]" test_case_data = [{"test_case": 'assert(palindrome("abba")==True)'}, {"test_case": 's="abbb"\nassert palindrome(S)==False'} diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py index b9f0a55..1b66fd2 100644 --- a/yaksh/python_assertion_evaluator.py +++ b/yaksh/python_assertion_evaluator.py @@ -47,8 +47,6 @@ class PythonAssertionEvaluator(CodeEvaluator): fname, lineno, func, text = info[-1] text = str(test_case).splitlines()[lineno-1] err = "{0} {1} in: {2}".format(type.__name__, str(value), text) - except TimeoutException: - raise except Exception: raise # Exception will be caught in CodeEvaluator. else: |