Adding extra check for negative checks where question wasn't asked

EmailTemplateFixes
Griffin Caprio 2015-01-07 14:34:47 -06:00
parent 22a8f7e214
commit f30492472a
2 changed files with 3 additions and 0 deletions

View File

@ -42,6 +42,8 @@ def check_actual_answers_against_expression(check_answer, actual_answer, check_q
# Negative Value Expressions
if check_answer.startswith("!"):
if len(actual_answer) == 0:
return False
for actual_answer in actual_answer:
if actual_answer == '':
return False

View File

@ -41,6 +41,7 @@ class QuestionSetTests(TestCase):
self.assertFalse(check_actual_answers_against_expression('3C', '3B', check_question))
self.assertTrue(check_actual_answers_against_expression('!3C', '3B', check_question))
self.assertFalse(check_actual_answers_against_expression('!3C', '', check_question))
self.assertFalse(check_actual_answers_against_expression('!3C', [''], check_question))
def test_dependencies_for_numeric_checks(self):
check_question = Question()