summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authormaheshgudi2017-03-11 02:17:41 +0530
committermaheshgudi2017-03-11 03:03:28 +0530
commitac292ed1099b49f9d0e8a7ed3699bacdd8031de3 (patch)
tree0856b97e9bcf418b40103d7679169e657c817948 /yaksh/models.py
parent6961ff1cf46d4b8591a4528a2c3fef156268eec5 (diff)
downloadonline_test-ac292ed1099b49f9d0e8a7ed3699bacdd8031de3.tar.gz
online_test-ac292ed1099b49f9d0e8a7ed3699bacdd8031de3.tar.bz2
online_test-ac292ed1099b49f9d0e8a7ed3699bacdd8031de3.zip
made minor template changes and fixed test_models
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index a323994..d583f7b 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1163,13 +1163,14 @@ class AnswerPaper(models.Model):
result['success'] = True
result['error'] = ['Correct answer']
else:
- if testcase.correct.splitlines() == user_answer.splitlines():
+ if testcase.correct.splitlines()\
+ == user_answer.splitlines():
result['success'] = True
result['error'] = ['Correct answer']
elif question.type == 'float':
testcase = question.get_test_case()
- if abs(testcase.correct-user_answer) <= testcase.error_margin:
+ if abs(testcase.correct - user_answer) <= testcase.error_margin:
result['success'] = True
result['error'] = ['Correct answer']
@@ -1353,6 +1354,6 @@ class FloatTestCase(TestCase):
"error_margin":self.error_margin}
def __str__(self):
- return u'Testcase | Correct: {0} | Error Margin: +or- {1}'.format(self.correct,
- self.error_margin
- )
+ return u'Testcase | Correct: {0} | Error Margin: +or- {1}'.format(
+ self.correct, self.error_margin
+ )