diff options
author | ankitjavalkar | 2016-12-19 17:43:41 +0530 |
---|---|---|
committer | ankitjavalkar | 2016-12-20 12:46:03 +0530 |
commit | 81d373983806b78d651e17b966bae0a8ccf3c4bb (patch) | |
tree | 8a4b5e37b71d8c13243480d2199ebf9dfeb517e0 /yaksh/tests | |
parent | f1da39aded67efa3da145851f0e9f687a3e434e5 (diff) | |
download | online_test-81d373983806b78d651e17b966bae0a8ccf3c4bb.tar.gz online_test-81d373983806b78d651e17b966bae0a8ccf3c4bb.tar.bz2 online_test-81d373983806b78d651e17b966bae0a8ccf3c4bb.zip |
Fix model test cases
Diffstat (limited to 'yaksh/tests')
-rw-r--r-- | yaksh/tests/test_code_server.py | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/yaksh/tests/test_code_server.py b/yaksh/tests/test_code_server.py index 7efd20b..d46c9dd 100644 --- a/yaksh/tests/test_code_server.py +++ b/yaksh/tests/test_code_server.py @@ -37,12 +37,15 @@ class TestCodeServer(unittest.TestCase): def test_infinite_loop(self): # Given - testdata = {'user_answer': 'while True: pass', - 'partial_grading': False, + testdata = {'metadata': {'user_answer': 'while True: pass', + 'language': 'python', + 'partial_grading': False + }, 'test_case_data': [{'test_case':'assert 1==2', + 'test_case_type': 'standardtestcase', 'weight': 0.0 - } - ]} + }] + } # When result = self.code_server.run_code( @@ -56,12 +59,15 @@ class TestCodeServer(unittest.TestCase): def test_correct_answer(self): # Given - testdata = {'user_answer': 'def f(): return 1', - 'partial_grading': False, + testdata = {'metadata': { 'user_answer': 'def f(): return 1', + 'language': 'python', + 'partial_grading': False + }, 'test_case_data': [{'test_case':'assert f() == 1', + 'test_case_type': 'standardtestcase', 'weight': 0.0 - } - ]} + }] + } # When result = self.code_server.run_code( @@ -75,12 +81,15 @@ class TestCodeServer(unittest.TestCase): def test_wrong_answer(self): # Given - testdata = {'user_answer': 'def f(): return 1', - 'partial_grading': False, + testdata = {'metadata': { 'user_answer': 'def f(): return 1', + 'language': 'python', + 'partial_grading': False + }, 'test_case_data': [{'test_case':'assert f() == 2', + 'test_case_type': 'standardtestcase', 'weight': 0.0 - } - ]} + }] + } # When result = self.code_server.run_code( @@ -98,12 +107,15 @@ class TestCodeServer(unittest.TestCase): def run_code(): """Run an infinite loop.""" - testdata = {'user_answer': 'while True: pass', - 'partial_grading': False, - 'test_case_data': [{'test_case':'assert 1==2', - 'weight': 0.0 - } - ]} + testdata = {'metadata': { 'user_answer': 'while True: pass', + 'language': 'python', + 'partial_grading': False + }, + 'test_case_data': [{'test_case':'assert 1==2', + 'test_case_type': 'standardtestcase', + 'weight': 0.0 + }] + } result = self.code_server.run_code( 'python', 'standardtestcase', json.dumps(testdata), '' ) |