Commit dce5bbc0 by Ayub-Khan

fix TNL-767 When students click "check" without submitting an answer, our basic…

fix TNL-767 When students click "check" without submitting an answer, our basic problem types respond in inconsistent ways.
parent e8925972
...@@ -2134,6 +2134,10 @@ class StringResponse(LoncapaResponse): ...@@ -2134,6 +2134,10 @@ class StringResponse(LoncapaResponse):
Note: for old code, which supports _or_ separator, we add some backward compatibility handling. Note: for old code, which supports _or_ separator, we add some backward compatibility handling.
Should be removed soon. When to remove it, is up to Lyla Fisher. Should be removed soon. When to remove it, is up to Lyla Fisher.
""" """
# if given answer is empty.
if not given:
return False
_ = self.capa_system.i18n.ugettext _ = self.capa_system.i18n.ugettext
# backward compatibility, should be removed in future. # backward compatibility, should be removed in future.
if self.backward: if self.backward:
......
...@@ -946,6 +946,13 @@ class StringResponseTest(ResponseTest): # pylint: disable=missing-docstring ...@@ -946,6 +946,13 @@ class StringResponseTest(ResponseTest): # pylint: disable=missing-docstring
hint = correct_map.get_hint('1_2_1') hint = correct_map.get_hint('1_2_1')
self.assertEqual(hint, self._get_random_number_result(problem.seed)) self.assertEqual(hint, self._get_random_number_result(problem.seed))
def test_empty_answer_graded_as_incorrect(self):
"""
Tests that problem should be graded incorrect if blank space is chosen as answer
"""
problem = self.build_problem(answer=" ", case_sensitive=False, regexp=True)
self.assert_grade(problem, u" ", "incorrect")
class CodeResponseTest(ResponseTest): # pylint: disable=missing-docstring class CodeResponseTest(ResponseTest): # pylint: disable=missing-docstring
xml_factory_class = CodeResponseXMLFactory xml_factory_class = CodeResponseXMLFactory
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment