summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprathamesh2020-06-30 08:36:18 +0530
committerprathamesh2020-06-30 08:36:18 +0530
commit60b1cc983c65654552c4b4a0d52114248ae0228f (patch)
tree57491da3f50eda30ccdbb827480e9021bd53f4e0
parentc27bc87afd68266da59af6e7f2b3b8cc8db13fad (diff)
downloadonline_test-60b1cc983c65654552c4b4a0d52114248ae0228f.tar.gz
online_test-60b1cc983c65654552c4b4a0d52114248ae0228f.tar.bz2
online_test-60b1cc983c65654552c4b4a0d52114248ae0228f.zip
Fix Tests
-rw-r--r--yaksh/evaluator_tests/test_bash_evaluation.py6
-rw-r--r--yaksh/evaluator_tests/test_c_cpp_evaluation.py3
-rw-r--r--yaksh/evaluator_tests/test_java_evaluation.py3
-rw-r--r--yaksh/evaluator_tests/test_python_evaluation.py3
-rw-r--r--yaksh/evaluator_tests/test_scilab_evaluation.py9
-rw-r--r--yaksh/test_models.py8
6 files changed, 19 insertions, 13 deletions
diff --git a/yaksh/evaluator_tests/test_bash_evaluation.py b/yaksh/evaluator_tests/test_bash_evaluation.py
index f86bf24..689f65b 100644
--- a/yaksh/evaluator_tests/test_bash_evaluation.py
+++ b/yaksh/evaluator_tests/test_bash_evaluation.py
@@ -129,7 +129,8 @@ class BashAssertionEvaluationTestCases(EvaluatorBaseTest):
# Then
self.assertFalse(result.get("success"))
- self.assert_correct_output("Error", result.get("error"))
+ self.assert_correct_output("Error",
+ result.get("error")[0]["message"])
def test_infinite_loop(self):
# Given
@@ -416,7 +417,8 @@ class BashHookEvaluationTestCases(EvaluatorBaseTest):
# Then
self.assertFalse(result.get('success'))
- self.assert_correct_output('Incorrect Answer', result.get('error'))
+ self.assert_correct_output('Incorrect Answer',
+ result.get('error')[0]['message'])
def test_assert_with_hook(self):
# Given
diff --git a/yaksh/evaluator_tests/test_c_cpp_evaluation.py b/yaksh/evaluator_tests/test_c_cpp_evaluation.py
index 14ed808..242d0b0 100644
--- a/yaksh/evaluator_tests/test_c_cpp_evaluation.py
+++ b/yaksh/evaluator_tests/test_c_cpp_evaluation.py
@@ -822,7 +822,8 @@ class CppHookEvaluationTestCases(EvaluatorBaseTest):
# Then
self.assertFalse(result.get('success'))
- self.assert_correct_output('Incorrect Answer', result.get('error'))
+ self.assert_correct_output('Incorrect Answer',
+ result.get('error')[0]['message'])
def test_assert_with_hook(self):
# Given
diff --git a/yaksh/evaluator_tests/test_java_evaluation.py b/yaksh/evaluator_tests/test_java_evaluation.py
index eb09f2f..3e30ba3 100644
--- a/yaksh/evaluator_tests/test_java_evaluation.py
+++ b/yaksh/evaluator_tests/test_java_evaluation.py
@@ -694,7 +694,8 @@ class JavaHookEvaluationTestCases(EvaluatorBaseTest):
# Then
self.assertFalse(result.get('success'))
- self.assert_correct_output('Incorrect Answer', result.get('error'))
+ self.assert_correct_output('Incorrect Answer',
+ result.get('error')[0]['message'])
def test_assert_with_hook(self):
# Given
diff --git a/yaksh/evaluator_tests/test_python_evaluation.py b/yaksh/evaluator_tests/test_python_evaluation.py
index de973cf..35c2322 100644
--- a/yaksh/evaluator_tests/test_python_evaluation.py
+++ b/yaksh/evaluator_tests/test_python_evaluation.py
@@ -803,7 +803,8 @@ class PythonHookEvaluationTestCases(EvaluatorBaseTest):
# Then
self.assertFalse(result.get('success'))
- self.assert_correct_output('Incorrect Answer', result.get('error'))
+ self.assert_correct_output('Incorrect Answer',
+ result.get('error')[0]['message'])
def test_assert_with_hook(self):
# Given
diff --git a/yaksh/evaluator_tests/test_scilab_evaluation.py b/yaksh/evaluator_tests/test_scilab_evaluation.py
index d3f1dc8..41abf94 100644
--- a/yaksh/evaluator_tests/test_scilab_evaluation.py
+++ b/yaksh/evaluator_tests/test_scilab_evaluation.py
@@ -92,9 +92,8 @@ class ScilabEvaluationTestCases(EvaluatorBaseTest):
grader = Grader(self.in_dir)
result = grader.evaluate(kwargs)
-
self.assertFalse(result.get("success"))
- self.assert_correct_output('error', result.get("error"))
+ self.assert_correct_output('error', result.get("error")[0]['message'])
def test_incorrect_answer(self):
user_answer = ("funcprot(0)\nfunction[c]=add(a,b)"
@@ -110,10 +109,10 @@ class ScilabEvaluationTestCases(EvaluatorBaseTest):
grader = Grader(self.in_dir)
result = grader.evaluate(kwargs)
-
- lines_of_error = len(result.get('error')[0].splitlines())
+ lines_of_error = len(result.get('error')[0]['message'].splitlines())
self.assertFalse(result.get('success'))
- self.assert_correct_output("Message", result.get('error'))
+ self.assert_correct_output("Message",
+ result.get('error')[0]["message"])
self.assertTrue(lines_of_error > 1)
def test_infinite_loop(self):
diff --git a/yaksh/test_models.py b/yaksh/test_models.py
index 4e6b1ae..37baf6e 100644
--- a/yaksh/test_models.py
+++ b/yaksh/test_models.py
@@ -431,7 +431,8 @@ class QuestionTestCases(unittest.TestCase):
self.test_case_upload_data = [{"test_case": "assert fact(3)==6",
"test_case_type": "standardtestcase",
"test_case_args": "",
- "weight": 1.0
+ "weight": 1.0,
+ "hidden": False
}]
questions_data = [{"snippet": "def fact()", "active": True,
"points": 1.0,
@@ -2029,7 +2030,8 @@ class TestCaseTestCases(unittest.TestCase):
{'test_case': 'assert myfunc(12, 13) == 15',
'test_case_type': 'standardtestcase',
'test_case_args': "",
- 'weight': 1.0
+ 'weight': 1.0,
+ 'hidden': False
}]
}
self.answer_data_json = json.dumps(answer_data)
@@ -2363,4 +2365,4 @@ class CommentModelTestCases(unittest.TestCase):
self.user1.delete()
self.course.delete()
self.post1.delete()
- self.comment1.delete() \ No newline at end of file
+ self.comment1.delete()