summaryrefslogtreecommitdiff
path: root/testapp/exam/evaluate_python_code.py
diff options
context:
space:
mode:
authorankitjavalkar2015-04-26 21:13:53 +0530
committerankitjavalkar2015-04-26 21:13:53 +0530
commit18df6d88a2e1a9dfe7d05ca97b2d69ff0569e088 (patch)
tree3a12a2497964c26f3750d81cf04e7953e795514a /testapp/exam/evaluate_python_code.py
parent8664a766406d6acf0d6a1688948153c407ea27f2 (diff)
downloadonline_test-18df6d88a2e1a9dfe7d05ca97b2d69ff0569e088.tar.gz
online_test-18df6d88a2e1a9dfe7d05ca97b2d69ff0569e088.tar.bz2
online_test-18df6d88a2e1a9dfe7d05ca97b2d69ff0569e088.zip
Make PEP8 consistent
Diffstat (limited to 'testapp/exam/evaluate_python_code.py')
-rw-r--r--testapp/exam/evaluate_python_code.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/testapp/exam/evaluate_python_code.py b/testapp/exam/evaluate_python_code.py
index 2682897..8892ae6 100644
--- a/testapp/exam/evaluate_python_code.py
+++ b/testapp/exam/evaluate_python_code.py
@@ -12,7 +12,7 @@ from language_registry import registry
class EvaluatePythonCode(EvaluateCode):
"""Tests the Python code obtained from Code Server"""
- ## Public Protocol ##########
+ # Public Protocol ##########
def evaluate_code(self):
success = False
@@ -37,22 +37,24 @@ class EvaluatePythonCode(EvaluateCode):
del tb
return success, err
- ## Private Protocol ##########
+ # Private Protocol ##########
def _create_test_case(self):
- """
- Create assert based test cases in python
+ """
+ Create assert based test cases in python
"""
test_code = ""
for test_case in self.test_case_data:
- pos_args = ", ".join(str(i) for i in test_case.get('pos_args')) if test_case.get('pos_args') \
- else ""
- kw_args = ", ".join(str(k+"="+a) for k, a in test_case.get('kw_args').iteritems()) \
+ pos_args = ", ".join(str(i) for i in test_case.get('pos_args')) \
+ if test_case.get('pos_args') else ""
+ kw_args = ", ".join(str(k+"="+a) for k, a
+ in test_case.get('kw_args').iteritems()) \
if test_case.get('kw_args') else ""
- args = pos_args + ", " + kw_args if pos_args and kw_args else pos_args or kw_args
- tcode = "assert {0}({1}) == {2}" \
- .format(test_case.get('func_name'), args, test_case.get('expected_answer'))
+ args = pos_args + ", " + kw_args if pos_args and kw_args \
+ else pos_args or kw_args
+ tcode = "assert {0}({1}) == {2}".format(test_case.get('func_name'),
+ args, test_case.get('expected_answer'))
test_code += tcode + "\n"
return test_code
-registry.register('python', EvaluatePythonCode) \ No newline at end of file
+registry.register('python', EvaluatePythonCode)