summaryrefslogtreecommitdiff
path: root/yaksh/python_assertion_evaluator.py
diff options
context:
space:
mode:
authormaheshgudi2017-11-06 16:34:37 +0530
committermaheshgudi2017-11-07 14:50:09 +0530
commit70a35ac2a001bd9638d9db5ed645d00f94ae4666 (patch)
treed404d9f9413b25fcc224fe3dea15eee1bc8ca88d /yaksh/python_assertion_evaluator.py
parent72b3d672735f624064431cbb0751d3cc3b08b6ba (diff)
downloadonline_test-70a35ac2a001bd9638d9db5ed645d00f94ae4666.tar.gz
online_test-70a35ac2a001bd9638d9db5ed645d00f94ae4666.tar.bz2
online_test-70a35ac2a001bd9638d9db5ed645d00f94ae4666.zip
Change module compare_stdio to error_messages
Diffstat (limited to 'yaksh/python_assertion_evaluator.py')
-rw-r--r--yaksh/python_assertion_evaluator.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py
index af89fc3..8c24e24 100644
--- a/yaksh/python_assertion_evaluator.py
+++ b/yaksh/python_assertion_evaluator.py
@@ -11,6 +11,7 @@ import importlib
from .file_utils import copy_files, delete_files
from .base_evaluator import BaseEvaluator
from .grader import TimeoutException
+from .error_messages import prettify_exceptions
class PythonAssertionEvaluator(BaseEvaluator):
@@ -74,26 +75,16 @@ class PythonAssertionEvaluator(BaseEvaluator):
exec(_tests, self.exec_scope)
except TimeoutException:
raise
- except AssertionError:
- exc_type, exc_value, exc_tb = sys.exc_info()
- value = "Expected answer from the test case didnt match the output"
- err = {"type": "assertion",
- "test_case": self.test_case,
- "exception": exc_type.__name__,
- "message": value,
- }
except Exception:
exc_type, exc_value, exc_tb = sys.exc_info()
tb_list = traceback.format_exception(exc_type, exc_value, exc_tb)
if len(tb_list) > 2:
del tb_list[1:3]
-
- err = {"type": "assertion",
- "traceback": "".join(tb_list),
- "exception": exc_type.__name__,
- "message": str(exc_value)
- }
-
+ err = prettify_exceptions(exc_type.__name__,
+ str(exc_value),
+ "".join(tb_list),
+ self.test_case
+ )
else:
success = True
err = None