summaryrefslogtreecommitdiff
path: root/yaksh/scilab_code_evaluator.py
diff options
context:
space:
mode:
authorankitjavalkar2016-05-09 13:00:04 +0530
committerankitjavalkar2016-05-10 11:54:34 +0530
commitc384c60c6d7fb5d30f3f929c518e0b41e084c4c4 (patch)
treed5b937e90bc7d3051b9c9128c4e1560b09db1c2c /yaksh/scilab_code_evaluator.py
parentd953f6f9e62671eeb5d6ea6498475167301dfe91 (diff)
downloadonline_test-c384c60c6d7fb5d30f3f929c518e0b41e084c4c4.tar.gz
online_test-c384c60c6d7fb5d30f3f929c518e0b41e084c4c4.tar.bz2
online_test-c384c60c6d7fb5d30f3f929c518e0b41e084c4c4.zip
- Adhere to 80 columns
- add docstrings - Fix further tests
Diffstat (limited to 'yaksh/scilab_code_evaluator.py')
-rw-r--r--yaksh/scilab_code_evaluator.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/yaksh/scilab_code_evaluator.py b/yaksh/scilab_code_evaluator.py
index f4aa5f8..91b4cb3 100644
--- a/yaksh/scilab_code_evaluator.py
+++ b/yaksh/scilab_code_evaluator.py
@@ -14,7 +14,8 @@ class ScilabCodeEvaluator(CodeEvaluator):
"""Tests the Scilab code obtained from Code Server"""
def setup(self):
super(ScilabCodeEvaluator, self).setup()
- self.submit_code_path = self.create_submit_code_file('function.sci')
+ self.submit_code_path = \
+ self.create_submit_code_file('function.sci')
def teardown(self):
super(ScilabCodeEvaluator, self).teardown()
@@ -23,8 +24,10 @@ class ScilabCodeEvaluator(CodeEvaluator):
def check_code(self, user_answer, test_case):
ref_code_path = test_case
- clean_ref_path, clean_test_case_path = self._set_test_code_file_path(ref_code_path)
- user_answer, terminate_commands = self._remove_scilab_exit(user_answer.lstrip())
+ clean_ref_path, clean_test_case_path = \
+ self._set_test_code_file_path(ref_code_path)
+ user_answer, terminate_commands = \
+ self._remove_scilab_exit(user_answer.lstrip())
success = False
self.write_to_submit_code_file(self.submit_code_path, user_answer)
@@ -35,12 +38,15 @@ class ScilabCodeEvaluator(CodeEvaluator):
code.\n Otherwise your code will not be evaluated\
correctly.\n"
- cmd = 'printf "lines(0)\nexec(\'{0}\',2);\nquit();"'.format(clean_ref_path)
+ cmd = 'printf "lines(0)\nexec(\'{0}\',2);\nquit();"'.format(
+ clean_ref_path
+ )
cmd += ' | timeout 8 scilab-cli -nb'
ret = self._run_command(cmd,
- shell=True,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ shell=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE
+ )
proc, stdout, stderr = ret
# Get only the error.