diff --git a/common/lib/capa/capa/tests/test_html_render.py b/common/lib/capa/capa/tests/test_html_render.py index e99308587e..492fcb2743 100644 --- a/common/lib/capa/capa/tests/test_html_render.py +++ b/common/lib/capa/capa/tests/test_html_render.py @@ -156,6 +156,7 @@ class CapaHtmlRenderTest(unittest.TestCase): 'hidden': False, 'do_math': False, 'id': '1_2_1', + 'trailing_text': '', 'size': None} expected_solution_context = {'id': '1_solution_1'} diff --git a/common/lib/capa/capa/tests/test_inputtypes.py b/common/lib/capa/capa/tests/test_inputtypes.py index e7f0b784bc..818240c188 100644 --- a/common/lib/capa/capa/tests/test_inputtypes.py +++ b/common/lib/capa/capa/tests/test_inputtypes.py @@ -182,6 +182,7 @@ class TextLineTest(unittest.TestCase): 'hidden': False, 'inline': False, 'do_math': False, + 'trailing_text': '', 'preprocessor': None} self.assertEqual(context, expected) @@ -209,11 +210,36 @@ class TextLineTest(unittest.TestCase): 'msg': '', 'hidden': False, 'inline': False, + 'trailing_text': '', 'do_math': True, 'preprocessor': {'class_name': preprocessorClass, 'script_src': script}} self.assertEqual(context, expected) + def test_trailing_text_rendering(self): + size = "42" + trailing_text = 'm/s' + xml_str = """""".format(size=size, tt=trailing_text) + + element = etree.fromstring(xml_str) + + state = {'value': 'BumbleBee', } + the_input = lookup_tag('textline')(test_system, element, state) + + context = the_input._get_render_context() + + expected = {'id': 'prob_1_2', + 'value': 'BumbleBee', + 'status': 'unanswered', + 'size': size, + 'msg': '', + 'hidden': False, + 'inline': False, + 'do_math': False, + 'trailing_text': trailing_text, + 'preprocessor': None} + self.assertEqual(context, expected) + class FileSubmissionTest(unittest.TestCase): '''