summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authormaheshgudi2016-11-18 16:30:36 +0530
committermaheshgudi2016-11-18 16:30:36 +0530
commit2cb22a95912e6fe6bf97046de654207e4f265d8c (patch)
tree6054de2d9a2b7214eb9c20ba7e09a592fbc2484f /yaksh
parent8db94931bfd2fd0bab9e3b1bf0fc6d4aeb7b9274 (diff)
downloadonline_test-2cb22a95912e6fe6bf97046de654207e4f265d8c.tar.gz
online_test-2cb22a95912e6fe6bf97046de654207e4f265d8c.tar.bz2
online_test-2cb22a95912e6fe6bf97046de654207e4f265d8c.zip
fixed test cases and added timeout exception in python assertion
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/evaluator_tests/test_python_evaluation.py13
-rw-r--r--yaksh/python_assertion_evaluator.py2
2 files changed, 7 insertions, 8 deletions
diff --git a/yaksh/evaluator_tests/test_python_evaluation.py b/yaksh/evaluator_tests/test_python_evaluation.py
index 9796fa2..acf5d0a 100644
--- a/yaksh/evaluator_tests/test_python_evaluation.py
+++ b/yaksh/evaluator_tests/test_python_evaluation.py
@@ -200,7 +200,7 @@ class PythonAssertionEvaluationTestCases(unittest.TestCase):
# Then
self.assertFalse(result.get("success"))
- self.assertEqual(3, len(err))
+ self.assertEqual(9, len(err))
for msg in name_error_msg:
self.assertIn(msg, result.get("error"))
@@ -254,7 +254,7 @@ class PythonAssertionEvaluationTestCases(unittest.TestCase):
# Then
self.assertFalse(result.get("success"))
- self.assertEqual(3, len(err))
+ self.assertEqual(9, len(err))
for msg in type_error_msg:
self.assertIn(msg, result.get("error"))
@@ -284,7 +284,7 @@ class PythonAssertionEvaluationTestCases(unittest.TestCase):
# Then
self.assertFalse(result.get("success"))
- self.assertEqual(4, len(err))
+ self.assertEqual(9, len(err))
for msg in value_error_msg:
self.assertIn(msg, result.get("error"))
@@ -341,7 +341,7 @@ class PythonAssertionEvaluationTestCases(unittest.TestCase):
# Then
self.assertFalse(result.get("success"))
- self.assertEqual(5, len(err))
+ self.assertEqual(6, len(err))
for msg in syntax_error_msg:
self.assertIn(msg, result.get("error"))
@@ -360,9 +360,6 @@ class PythonAssertionEvaluationTestCases(unittest.TestCase):
]
name_error_msg = ["Traceback",
"call",
- "File",
- "line",
- "<string>",
"NameError",
"name 'S' is not defined"
]
@@ -379,7 +376,7 @@ class PythonAssertionEvaluationTestCases(unittest.TestCase):
# Then
self.assertFalse(result.get("success"))
- self.assertEqual(3, len(err))
+ self.assertEqual(7, len(err))
for msg in name_error_msg:
self.assertIn(msg, result.get("error"))
diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py
index ba1890f..986dbf2 100644
--- a/yaksh/python_assertion_evaluator.py
+++ b/yaksh/python_assertion_evaluator.py
@@ -73,6 +73,8 @@ class PythonAssertionEvaluator(CodeEvaluator):
type.__name__,
str(value), text
)
+ except TimeoutException:
+ raise
except Exception:
msg = traceback.format_exc(limit=0)
err = "Error in Test case: {0}".format(msg)