summaryrefslogtreecommitdiff
path: root/yaksh/python_assertion_evaluator.py
diff options
context:
space:
mode:
authorankitjavalkar2016-11-16 11:47:26 +0530
committerankitjavalkar2016-11-16 11:47:26 +0530
commit31a15a666e69d96b5062596c79641645a64fcdb2 (patch)
tree70c5ccad0465bf3c75a2ea4207be222afd2de2d8 /yaksh/python_assertion_evaluator.py
parentb32d7e91fe608c4cbd09b50520d4a3cab75d2e53 (diff)
downloadonline_test-31a15a666e69d96b5062596c79641645a64fcdb2.tar.gz
online_test-31a15a666e69d96b5062596c79641645a64fcdb2.tar.bz2
online_test-31a15a666e69d96b5062596c79641645a64fcdb2.zip
Modify docstrings of evaluators
Diffstat (limited to 'yaksh/python_assertion_evaluator.py')
-rw-r--r--yaksh/python_assertion_evaluator.py20
1 files changed, 20 insertions, 0 deletions
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: