summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yaksh/bash_code_evaluator.py9
-rw-r--r--yaksh/python_assertion_evaluator.py20
2 files changed, 26 insertions, 3 deletions
diff --git a/yaksh/bash_code_evaluator.py b/yaksh/bash_code_evaluator.py
index 7575725..b5974d2 100644
--- a/yaksh/bash_code_evaluator.py
+++ b/yaksh/bash_code_evaluator.py
@@ -40,14 +40,17 @@ class BashCodeEvaluator(CodeEvaluator):
Returns
--------
+ success - Boolean, indicating if code was executed successfully, correctly
+ weight - Float, indicating total weight of all successful test cases
+ error - String, error message if success is false
- returns (True, "Correct answer") : If the student script passes all
+ returns (True, "Correct answer", 1.0) : If the student script passes all
test cases/have same output, when compared to the instructor script
- returns (False, error_msg): If the student script fails a single
+ returns (False, error_msg, 0.0): If the student script fails a single
test/have dissimilar output, when compared to the instructor script.
- Returns (False, error_msg): If mandatory arguments are not files or if
+ Returns (False, error_msg, 0.0): If mandatory arguments are not files or if
the required permissions are not given to the file(s).
"""
ref_code_path = test_case
diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py
index 8924643..1cc4fa4 100644
--- a/yaksh/python_assertion_evaluator.py
+++ b/yaksh/python_assertion_evaluator.py
@@ -37,6 +37,26 @@ class PythonAssertionEvaluator(CodeEvaluator):
return self.exec_scope
def check_code(self, user_answer, file_paths, partial_grading, test_case, weight):
+ """ Function validates user answer by running an assertion based test case
+ against it
+
+ Returns
+ --------
+ Returns a tuple (success, error, test_case_weight)
+
+ success - Boolean, indicating if code was executed successfully, correctly
+ weight - Float, indicating total weight of all successful test cases
+ error - String, error message if success is false
+
+ returns (True, "Correct answer", 1.0) : If the student script passes all
+ test cases/have same output, when compared to the instructor script
+
+ returns (False, error_msg, 0.0): If the student script fails a single
+ test/have dissimilar output, when compared to the instructor script.
+
+ Returns (False, error_msg, 0.0): If mandatory arguments are not files or if
+ the required permissions are not given to the file(s).
+ """
success = False
test_case_weight = 0.0
try: