summaryrefslogtreecommitdiff
path: root/yaksh/tests/test_code_server.py
diff options
context:
space:
mode:
authorankitjavalkar2016-11-04 18:07:35 +0530
committerankitjavalkar2016-11-10 12:43:14 +0530
commit576c92b3b7d8989bf6bb99316d096f48f5b4cc24 (patch)
treef1f36b8cae1c9ffad9c5cb5637e857ad9b01aba4 /yaksh/tests/test_code_server.py
parent0bfa58d8705fa08b45a208a4cec98dd267799f8a (diff)
downloadonline_test-576c92b3b7d8989bf6bb99316d096f48f5b4cc24.tar.gz
online_test-576c92b3b7d8989bf6bb99316d096f48f5b4cc24.tar.bz2
online_test-576c92b3b7d8989bf6bb99316d096f48f5b4cc24.zip
Fix test cases for partial grading feature
Diffstat (limited to 'yaksh/tests/test_code_server.py')
-rw-r--r--yaksh/tests/test_code_server.py24
1 files changed, 20 insertions, 4 deletions
diff --git a/yaksh/tests/test_code_server.py b/yaksh/tests/test_code_server.py
index 8835110..d446444 100644
--- a/yaksh/tests/test_code_server.py
+++ b/yaksh/tests/test_code_server.py
@@ -38,7 +38,11 @@ class TestCodeServer(unittest.TestCase):
def test_inifinite_loop(self):
# Given
testdata = {'user_answer': 'while True: pass',
- 'test_case_data': [{'test_case':'assert 1==2'}]}
+ 'partial_grading': True,
+ 'test_case_data': [{'test_case':'assert 1==2',
+ 'marks': 0.0
+ }
+ ]}
# When
result = self.code_server.run_code(
@@ -53,7 +57,11 @@ class TestCodeServer(unittest.TestCase):
def test_correct_answer(self):
# Given
testdata = {'user_answer': 'def f(): return 1',
- 'test_case_data': [{'test_case':'assert f() == 1'}]}
+ 'partial_grading': True,
+ 'test_case_data': [{'test_case':'assert f() == 1',
+ 'marks': 0.0
+ }
+ ]}
# When
result = self.code_server.run_code(
@@ -68,7 +76,11 @@ class TestCodeServer(unittest.TestCase):
def test_wrong_answer(self):
# Given
testdata = {'user_answer': 'def f(): return 1',
- 'test_case_data': [{'test_case':'assert f() == 2'}]}
+ 'partial_grading': True,
+ 'test_case_data': [{'test_case':'assert f() == 2',
+ 'marks': 0.0
+ }
+ ]}
# When
result = self.code_server.run_code(
@@ -87,7 +99,11 @@ class TestCodeServer(unittest.TestCase):
def run_code():
"""Run an infinite loop."""
testdata = {'user_answer': 'while True: pass',
- 'test_case_data': [{'test_case':'assert 1==2'}]}
+ 'partial_grading': True,
+ 'test_case_data': [{'test_case':'assert 1==2',
+ 'marks': 0.0
+ }
+ ]}
result = self.code_server.run_code(
'python', 'standardtestcase', json.dumps(testdata), ''
)