summaryrefslogtreecommitdiff
path: root/testapp/exam/evaluate_bash_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_bash_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_bash_code.py')
-rw-r--r--testapp/exam/evaluate_bash_code.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/testapp/exam/evaluate_bash_code.py b/testapp/exam/evaluate_bash_code.py
index 49f20fa..2905d65 100644
--- a/testapp/exam/evaluate_bash_code.py
+++ b/testapp/exam/evaluate_bash_code.py
@@ -13,14 +13,15 @@ from language_registry import registry
class EvaluateBashCode(EvaluateCode):
"""Tests the Bash code obtained from Code Server"""
- ## Public Protocol ##########
+ # Public Protocol ##########
def evaluate_code(self):
submit_path = self.create_submit_code_file('submit.sh')
self.set_file_as_executable(submit_path)
get_ref_path, get_test_case_path = self.ref_code_path.strip().split(',')
get_ref_path = get_ref_path.strip()
get_test_case_path = get_test_case_path.strip()
- ref_path, test_case_path = self.set_test_code_file_path(get_ref_path, get_test_case_path)
+ ref_path, test_case_path = self.set_test_code_file_path(get_ref_path,
+ get_test_case_path)
success, err = self._check_bash_script(ref_path, submit_path,
test_case_path)
@@ -30,7 +31,7 @@ class EvaluateBashCode(EvaluateCode):
return success, err
- ## Private Protocol ##########
+ # Private Protocol ##########
def _check_bash_script(self, ref_path, submit_path,
test_case_path=None):
""" Function validates student script using instructor script as
@@ -86,12 +87,11 @@ class EvaluateBashCode(EvaluateCode):
return False, "No test case at %s" % test_case_path
if not os.access(ref_path, os.R_OK):
return False, "Test script %s, not readable" % test_case_path
- valid_answer = True # We initially make it one, so that we can
- # stop once a test case fails
- loop_count = 0 # Loop count has to be greater than or
- # equal to one.
- # Useful for caching things like empty
- # test files,etc.
+ # valid_answer is True, so that we can stop once a test case fails
+ valid_answer = True
+ # loop_count has to be greater than or equal to one.
+ # Useful for caching things like empty test files,etc.
+ loop_count = 0
test_cases = open(test_case_path).readlines()
num_lines = len(test_cases)
for test_case in test_cases:
@@ -116,4 +116,4 @@ class EvaluateBashCode(EvaluateCode):
return False, err
-registry.register('bash', EvaluateBashCode) \ No newline at end of file
+registry.register('bash', EvaluateBashCode)