summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/bash_code_evaluator.py4
-rw-r--r--yaksh/bash_stdio_evaluator.py2
-rw-r--r--yaksh/cpp_code_evaluator.py2
-rw-r--r--yaksh/cpp_stdio_evaluator.py2
-rw-r--r--yaksh/grader.py6
-rw-r--r--yaksh/java_code_evaluator.py2
-rw-r--r--yaksh/java_stdio_evaluator.py2
-rw-r--r--yaksh/python_assertion_evaluator.py2
-rw-r--r--yaksh/scilab_code_evaluator.py6
9 files changed, 14 insertions, 14 deletions
diff --git a/yaksh/bash_code_evaluator.py b/yaksh/bash_code_evaluator.py
index 9da404a..a4f1389 100644
--- a/yaksh/bash_code_evaluator.py
+++ b/yaksh/bash_code_evaluator.py
@@ -112,7 +112,7 @@ class BashCodeEvaluator(BaseEvaluator):
)
proc, stdnt_stdout, stdnt_stderr = ret
if inst_stdout == stdnt_stdout:
- mark_fraction = float(self.weight) if self.partial_grading else 0.0
+ mark_fraction = 1.0 if self.partial_grading else 0.0
return True, None, mark_fraction
else:
err = "Error: expected %s, got %s" % (inst_stdout + inst_stderr,
@@ -155,7 +155,7 @@ class BashCodeEvaluator(BaseEvaluator):
proc, stdnt_stdout, stdnt_stderr = ret
valid_answer = inst_stdout == stdnt_stdout
if valid_answer and (num_lines == loop_count):
- mark_fraction = float(self.weight) if self.partial_grading else 0.0
+ mark_fraction = 1.0 if self.partial_grading else 0.0
return True, None, mark_fraction
else:
err = ("Error:expected"
diff --git a/yaksh/bash_stdio_evaluator.py b/yaksh/bash_stdio_evaluator.py
index 50ee0d6..334620d 100644
--- a/yaksh/bash_stdio_evaluator.py
+++ b/yaksh/bash_stdio_evaluator.py
@@ -55,5 +55,5 @@ class BashStdIOEvaluator(StdIOEvaluator):
self.expected_input,
self.expected_output
)
- mark_fraction = float(self.weight) if self.partial_grading and success else 0.0
+ mark_fraction = 1.0 if self.partial_grading and success else 0.0
return success, err, mark_fraction
diff --git a/yaksh/cpp_code_evaluator.py b/yaksh/cpp_code_evaluator.py
index d4e2253..4c8e938 100644
--- a/yaksh/cpp_code_evaluator.py
+++ b/yaksh/cpp_code_evaluator.py
@@ -139,7 +139,7 @@ class CppCodeEvaluator(BaseEvaluator):
proc, stdout, stderr = ret
if proc.returncode == 0:
success, err = True, None
- mark_fraction = float(self.weight) if self.partial_grading else 0.0
+ mark_fraction = 1.0 if self.partial_grading else 0.0
else:
err = "{0} \n {1}".format(stdout, stderr)
else:
diff --git a/yaksh/cpp_stdio_evaluator.py b/yaksh/cpp_stdio_evaluator.py
index d1dcd65..b302fa4 100644
--- a/yaksh/cpp_stdio_evaluator.py
+++ b/yaksh/cpp_stdio_evaluator.py
@@ -112,5 +112,5 @@ class CppStdIOEvaluator(StdIOEvaluator):
err = err + "\n" + e
except:
err = err + "\n" + stdnt_stderr
- mark_fraction = float(self.weight) if self.partial_grading and success else 0.0
+ mark_fraction = 1.0 if self.partial_grading and success else 0.0
return success, err, mark_fraction
diff --git a/yaksh/grader.py b/yaksh/grader.py
index 0c057c2..086abb7 100644
--- a/yaksh/grader.py
+++ b/yaksh/grader.py
@@ -100,10 +100,10 @@ class Grader(object):
self.setup()
test_case_instances = self.get_evaluator_objects(kwargs)
with change_dir(self.in_dir):
- success, error, mark = self.safe_evaluate(test_case_instances)
+ success, error, weight = self.safe_evaluate(test_case_instances)
self.teardown()
- result = {'success': success, 'error': error, 'weight': mark}
+ result = {'success': success, 'error': error, 'weight': weight}
return result
# Private Protocol ##########
@@ -144,7 +144,7 @@ class Grader(object):
test_case_instance.compile_code()
test_case_success, err, mark_fraction = test_case_instance.check_code()
if test_case_success:
- weight += mark_fraction
+ weight += mark_fraction * test_case_instance.weight
else:
error.append(err)
test_case_success_status[idx] = test_case_success
diff --git a/yaksh/java_code_evaluator.py b/yaksh/java_code_evaluator.py
index df6abf5..e6dc628 100644
--- a/yaksh/java_code_evaluator.py
+++ b/yaksh/java_code_evaluator.py
@@ -147,7 +147,7 @@ class JavaCodeEvaluator(BaseEvaluator):
proc, stdout, stderr = ret
if proc.returncode == 0:
success, err = True, None
- mark_fraction = float(seelf.weight) if self.partial_grading else 0.0
+ mark_fraction = 1.0 if self.partial_grading else 0.0
else:
err = stdout + "\n" + stderr
else:
diff --git a/yaksh/java_stdio_evaluator.py b/yaksh/java_stdio_evaluator.py
index a854847..48f265d 100644
--- a/yaksh/java_stdio_evaluator.py
+++ b/yaksh/java_stdio_evaluator.py
@@ -85,5 +85,5 @@ class JavaStdIOEvaluator(StdIOEvaluator):
err = err + "\n" + e
except:
err = err + "\n" + stdnt_stderr
- mark_fraction = float(self.weight) if self.partial_grading and success else 0.0
+ mark_fraction = 1.0 if self.partial_grading and success else 0.0
return success, err, mark_fraction
diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py
index 749a6ec..ae86c46 100644
--- a/yaksh/python_assertion_evaluator.py
+++ b/yaksh/python_assertion_evaluator.py
@@ -91,6 +91,6 @@ class PythonAssertionEvaluator(BaseEvaluator):
else:
success = True
err = None
- mark_fraction = float(self.weight) if self.partial_grading else 0.0
+ mark_fraction = 1.0 if self.partial_grading else 0.0
del tb
return success, err, mark_fraction
diff --git a/yaksh/scilab_code_evaluator.py b/yaksh/scilab_code_evaluator.py
index 7ffcd2b..f5c81b5 100644
--- a/yaksh/scilab_code_evaluator.py
+++ b/yaksh/scilab_code_evaluator.py
@@ -47,7 +47,7 @@ class ScilabCodeEvaluator(BaseEvaluator):
self._remove_scilab_exit(self.user_answer.lstrip())
success = False
- test_case_weight = 0.0
+ mark_fraction = 0.0
self.write_to_submit_code_file(self.submit_code_path, self.user_answer)
self.write_to_submit_code_file(self.test_code_path, self.test_case)
# Throw message if there are commmands that terminates scilab
@@ -75,13 +75,13 @@ class ScilabCodeEvaluator(BaseEvaluator):
stdout = self._strip_output(stdout)
if proc.returncode == 5:
success, err = True, None
- test_case_weight = float(self.weight) if self.partial_grading else 0.0
+ mark_fraction = 1.0 if self.partial_grading else 0.0
else:
err = add_err + stdout
else:
err = add_err + stderr
- return success, err, test_case_weight
+ return success, err, mark_fraction
def _remove_scilab_exit(self, string):
"""