From c4c5a8e8a9cc2ae4bdf908c2c26150dc699c3b58 Mon Sep 17 00:00:00 2001 From: Adam Palay Date: Tue, 20 Dec 2016 13:34:28 -0500 Subject: [PATCH] Revert "tnl-4141 only whitespaces not allowed in answer and fixed the pep8 violation." This reverts commit 3ad2f0923342a640d412ebfc03d81461427979cd. --- common/lib/capa/capa/responsetypes.py | 5 +---- common/lib/capa/capa/tests/test_responsetypes.py | 8 ++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py index e8cd5ddc56..9332417197 100644 --- a/common/lib/capa/capa/responsetypes.py +++ b/common/lib/capa/capa/responsetypes.py @@ -190,10 +190,7 @@ class LoncapaResponse(object): raise LoncapaProblemError(msg) for prop in self.required_attributes: - prop_value = xml.get(prop) - if prop_value: # Stripping off the empty strings - prop_value = prop_value.strip() - if not prop_value: + if not xml.get(prop): msg = "Error in problem specification: %s missing required attribute %s" % ( unicode(self), prop) msg += "\nSee XML source line %s" % getattr( diff --git a/common/lib/capa/capa/tests/test_responsetypes.py b/common/lib/capa/capa/tests/test_responsetypes.py index e70ee0ae10..982924eb61 100644 --- a/common/lib/capa/capa/tests/test_responsetypes.py +++ b/common/lib/capa/capa/tests/test_responsetypes.py @@ -974,12 +974,12 @@ class StringResponseTest(ResponseTest): # pylint: disable=missing-docstring hint = correct_map.get_hint('1_2_1') self.assertEqual(hint, self._get_random_number_result(problem.seed)) - def test_empty_answer_problem_creation_not_allowed(self): + def test_empty_answer_graded_as_incorrect(self): """ - Tests that empty answer string is not allowed to create a problem + Tests that problem should be graded incorrect if blank space is chosen as answer """ - with self.assertRaises(LoncapaProblemError): - self.build_problem(answer=" ", case_sensitive=False, regexp=True) + problem = self.build_problem(answer=" ", case_sensitive=False, regexp=True) + self.assert_grade(problem, u" ", "incorrect") class CodeResponseTest(ResponseTest): # pylint: disable=missing-docstring