diff --git a/common/lib/capa/capa/capa_problem.py b/common/lib/capa/capa/capa_problem.py index 1571ad54b8..b1753066ea 100644 --- a/common/lib/capa/capa/capa_problem.py +++ b/common/lib/capa/capa/capa_problem.py @@ -64,6 +64,7 @@ html_transforms = { # These should be removed from HTML output, including all subelements html_problem_semantics = [ + "additional_answer", "codeparam", "responseparam", "answer", diff --git a/common/lib/capa/capa/tests/test_capa_problem.py b/common/lib/capa/capa/tests/test_capa_problem.py index f3f06c3936..c1e3c34935 100644 --- a/common/lib/capa/capa/tests/test_capa_problem.py +++ b/common/lib/capa/capa/tests/test_capa_problem.py @@ -190,6 +190,23 @@ class CAPAProblemTest(unittest.TestCase): } ) + def test_additional_answer_is_skipped_from_resulting_html(self): + """Tests that additional_answer element is not present in transformed HTML""" + xml = """ + +

Be sure to check your spelling.

+ + + Anyone who looks the world as if it was a game of chess deserves to lose. + + + +
+ """ + problem = new_loncapa_problem(xml) + self.assertEqual(len(problem.extracted_tree.xpath('//additional_answer')), 0) + self.assertNotIn('additional_answer', problem.get_html()) + def test_non_accessible_inputtype(self): """ Verify that tag with question text is not removed when inputtype is not fully accessible.