Exemplo n.º 1
0
 def runTest(self):
     # ARRANGE #
     root = Element('root')
     table = Table(TableFormat(first_row_is_header=True),
                   [
                       [text_cell('ignored'), text_cell('ignored')],
                       [text_cell('ignored'), text_cell('ignored')],
                   ])
     # ACT #
     ret_val = sut.render(ConstantPRenderer('para text'),
                          root, table)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root>'
                      '<table>'
                      '<tr>'
                      '<th>para text</th>'
                      '<th>para text</th>'
                      '</tr>'
                      '<tr>'
                      '<td>para text</td>'
                      '<td>para text</td>'
                      '</tr>'
                      '</table>'
                      '</root>',
                      xml_string)
     self.assertIs(list(root)[0],
                   ret_val)
Exemplo n.º 2
0
 def test_single_anchor_with_cross_reference_as_anchored_text(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([
         core.AnchorText(
             core.CrossReferenceText(
                 StringText('cross ref title'),
                 CrossReferenceTargetTestImpl('cross ref target'),
                 target_is_id_in_same_document=True),
             CrossReferenceTargetTestImpl('anchor target')),
     ])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER),
                          root,
                          para,
                          skip_surrounding_p_element=True)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual(
         '<root>'
         '<span id="anchor target">'
         '<a href="#cross ref target">cross ref title</a>'
         '</span>'
         '</root>', xml_string)
     self.assertIs(root, ret_val)
Exemplo n.º 3
0
 def runTest(self):
     # ARRANGE #
     root = Element('root')
     table = Table(TableFormat(first_row_is_header=True), [
         [text_cell('ignored'), text_cell('ignored')],
         [text_cell('ignored'), text_cell('ignored')],
     ])
     # ACT #
     ret_val = sut.render(ConstantPRenderer('para text'), root, table)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual(
         '<root>'
         '<table>'
         '<tr>'
         '<th>para text</th>'
         '<th>para text</th>'
         '</tr>'
         '<tr>'
         '<td>para text</td>'
         '<td>para text</td>'
         '</tr>'
         '</table>'
         '</root>', xml_string)
     self.assertIs(list(root)[0], ret_val)
Exemplo n.º 4
0
 def test_empty(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER), root, para)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root />', xml_string)
     self.assertIs(root, ret_val)
Exemplo n.º 5
0
 def test_single_empty_row(self):
     # ARRANGE #
     root = Element('root')
     table = Table(TableFormat(), [[]])
     # ACT #
     ret_val = sut.render(ConstantPRenderer('para text'), root, table)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root />', xml_string)
     self.assertIs(root, ret_val)
Exemplo n.º 6
0
 def test_two_string_text(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([core.StringText('_1_'), core.StringText('_2_')])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER), root, para)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root>' '<p>_1_<br />_2_</p>' '</root>', xml_string)
     self._assert_first_child__of_actual_is_same_object_as(root, ret_val)
Exemplo n.º 7
0
 def test_empty(self):
     # ARRANGE #
     root = Element('root')
     sc = SectionContents([], [])
     # ACT #
     ret_val = TEST_RENDERER.render_section_contents(
         sut.Environment(0), root, sc)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root />', xml_string)
     self.assertIs(root, ret_val)
Exemplo n.º 8
0
 def test_empty(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER), root, para)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root />',
                      xml_string)
     self.assertIs(root, ret_val)
Exemplo n.º 9
0
 def runTest(self):
     # ARRANGE #
     root = Element('root')
     ll = LiteralLayout(LITERAL_MULTI_LINE_TEXT, 'the-class')
     # ACT #
     ret_val = sut.render(root, ll)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual(LITERAL_MULTI_LINE_TEXT_RESULT_W_CLASS,
                      xml_string)
     self.assertIs(list(root)[0],
                   ret_val)
Exemplo n.º 10
0
 def runTest(self):
     # ARRANGE #
     root = Element('root')
     ll = LiteralLayout(LITERAL_MULTI_LINE_TEXT)
     # ACT #
     ret_val = sut.render(root, ll)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual(LITERAL_MULTI_LINE_TEXT_RESULT,
                      xml_string)
     self.assertIs(list(root)[0],
                   ret_val)
Exemplo n.º 11
0
 def test_single_string_text(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([core.StringText('string text')])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER), root, para)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root>'
                      '<p>string text</p>'
                      '</root>',
                      xml_string)
     self._assert_first_child__of_actual_is_same_object_as(root, ret_val)
Exemplo n.º 12
0
 def test_two_string_text(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([core.StringText('_1_'), core.StringText('_2_')])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER),
                          root,
                          para,
                          skip_surrounding_p_element=True)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root>' '_1_<br />_2_' '</root>', xml_string)
     self.assertIs(root, ret_val)
Exemplo n.º 13
0
 def test_empty(self):
     # ARRANGE #
     root = Element('root')
     sc = SectionContents([], [])
     # ACT #
     ret_val = TEST_RENDERER.render_section_contents(sut.Environment(0),
                                                     root,
                                                     sc)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root />',
                      xml_string)
     self.assertIs(root,
                   ret_val)
Exemplo n.º 14
0
 def test_empty(self):
     # ARRANGE #
     for list_type in ListType:
         with self.subTest(list_type=list_type):
             root = Element('root')
             the_list = HeaderContentList([], Format(list_type))
             # ACT #
             ret_val = sut.render(TextRenderer(TARGET_RENDERER),
                                  ConstantPRenderer('para text'), root,
                                  the_list)
             # ASSERT #
             xml_string = as_unicode_str(root)
             self.assertEqual('<root />', xml_string)
             self.assertIs(root, ret_val)
Exemplo n.º 15
0
 def test_single_string_text(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([core.StringText('string text')])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER), root, para,
                          skip_surrounding_p_element=True)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root>'
                      'string text'
                      '</root>',
                      xml_string)
     self.assertIs(root, ret_val)
Exemplo n.º 16
0
 def test_single_empty_row(self):
     # ARRANGE #
     root = Element('root')
     table = Table(TableFormat(),
                   [[]])
     # ACT #
     ret_val = sut.render(ConstantPRenderer('para text'),
                          root, table)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root />',
                      xml_string)
     self.assertIs(root,
                   ret_val)
Exemplo n.º 17
0
 def test_simple_document(self):
     # ARRANGE #
     root = Element('root')
     complex_populator = sut.ComplexElementPopulator([
         SingleParaPopulator('first'),
         SingleParaPopulator('second'),
     ])
     # ACT #
     complex_populator.apply(root)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root>'
                      '<p>first</p>'
                      '<p>second</p>'
                      '</root>', xml_string)
Exemplo n.º 18
0
 def test_simple_document(self):
     # ARRANGE #
     root = Element('root')
     complex_populator = sut.ComplexElementPopulator([
         SingleParaPopulator('first'),
         SingleParaPopulator('second'),
     ])
     # ACT #
     complex_populator.apply(root)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root>'
                      '<p>first</p>'
                      '<p>second</p>'
                      '</root>',
                      xml_string)
Exemplo n.º 19
0
 def test_single_anchor_with_string_as_anchored_text(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([core.AnchorText(core.StringText('concrete string'),
                                       CrossReferenceTargetTestImpl('target')),
                       ])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER), root, para,
                          skip_surrounding_p_element=True)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root>'
                      '<span id="target">concrete string</span>'
                      '</root>',
                      xml_string)
     self.assertIs(root, ret_val)
Exemplo n.º 20
0
 def test_empty(self):
     # ARRANGE #
     for list_type in ListType:
         with self.subTest(list_type=list_type):
             root = Element('root')
             the_list = HeaderContentList([],
                                          Format(list_type))
             # ACT #
             ret_val = sut.render(TextRenderer(TARGET_RENDERER),
                                  ConstantPRenderer('para text'),
                                  root, the_list)
             # ASSERT #
             xml_string = as_unicode_str(root)
             self.assertEqual('<root />',
                              xml_string)
             self.assertIs(root,
                           ret_val)
Exemplo n.º 21
0
 def test_single_anchor_with_string_as_anchored_text(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([core.AnchorText(core.StringText('concrete string'),
                                       CrossReferenceTargetTestImpl('target')),
                       ])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER), root, para)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root>'
                      '<p>'
                      '<span id="target">concrete string</span>'
                      '</p>'
                      '</root>',
                      xml_string)
     self._assert_first_child__of_actual_is_same_object_as(root, ret_val)
Exemplo n.º 22
0
 def test_cross_reference_and_string(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([core.CrossReferenceText(StringText('title'),
                                               CrossReferenceTargetTestImpl('target'),
                                               target_is_id_in_same_document=True),
                       core.StringText('string')])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER), root, para,
                          skip_surrounding_p_element=True)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root>'
                      '<a href="#target">title</a><br />string'
                      '</root>',
                      xml_string)
     self.assertIs(root, ret_val)
Exemplo n.º 23
0
 def test(self):
     cases = [
         Case(
             'test_singleton_element_without_contents',
             items=
             [HeaderContentListItem(text('header'))],
             expected=
             '<root>'
             '<dl>'
             '<dt>header</dt>'
             '</dl>'
             '</root>'
         ),
         Case(
             'test_singleton_element_with_multiple_content_paragraphs',
             items=
             [HeaderContentListItem(text('header'),
                                    [para('ignored'),
                                     para('ignored')])],
             expected=
             '<root>'
             '<dl>'
             '<dt>header</dt>'
             '<dd>'
             '<p>every para text</p>'
             '<p>every para text</p>'
             '</dd>'
             '</dl>'
             '</root>'
         ),
     ]
     for case in cases:
         with self.subTest(case.name):
             root = Element('root')
             the_list = HeaderContentList(case.items, Format(ListType.VARIABLE_LIST))
             # ACT #
             ret_val = sut.render(TextRenderer(TARGET_RENDERER),
                                  ConstantPRenderer('every para text'),
                                  root, the_list)
             # ASSERT #
             xml_string = as_unicode_str(root)
             self.assertEqual(case.expected,
                              xml_string)
             self.assertIs(list(root)[0],
                           ret_val)
Exemplo n.º 24
0
 def test_single_anchor_with_string_as_anchored_text(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([
         core.AnchorText(core.StringText('concrete string'),
                         CrossReferenceTargetTestImpl('target')),
     ])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER), root, para)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual(
         '<root>'
         '<p>'
         '<span id="target">concrete string</span>'
         '</p>'
         '</root>', xml_string)
     self._assert_first_child__of_actual_is_same_object_as(root, ret_val)
Exemplo n.º 25
0
 def test_single_cross_reference_to_not_id_in_same_document(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([core.CrossReferenceText(StringText('title'),
                                               CrossReferenceTargetTestImpl('target'),
                                               target_is_id_in_same_document=False),
                       ])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER), root, para)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root>'
                      '<p>'
                      '<a href="target">title</a>'
                      '</p>'
                      '</root>',
                      xml_string)
     self._assert_first_child__of_actual_is_same_object_as(root, ret_val)
Exemplo n.º 26
0
 def test_single_anchor_with_string_as_anchored_text(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([
         core.AnchorText(core.StringText('concrete string'),
                         CrossReferenceTargetTestImpl('target')),
     ])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER),
                          root,
                          para,
                          skip_surrounding_p_element=True)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual(
         '<root>'
         '<span id="target">concrete string</span>'
         '</root>', xml_string)
     self.assertIs(root, ret_val)
Exemplo n.º 27
0
 def test_two_cross_reference(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([core.CrossReferenceText(StringText('title 1'),
                                               CrossReferenceTargetTestImpl('target 1')),
                       core.CrossReferenceText(StringText('title 2'),
                                               CrossReferenceTargetTestImpl('target 2'))])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER), root, para,
                          skip_surrounding_p_element=True)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root>'
                      '<a href="#target 1">'
                      'title 1</a><br /><a href="#target 2">title 2'
                      '</a>'
                      '</root>',
                      xml_string)
     self.assertIs(root, ret_val)
Exemplo n.º 28
0
 def test_single_cross_reference_to_not_id_in_same_document(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([
         core.CrossReferenceText(StringText('title'),
                                 CrossReferenceTargetTestImpl('target'),
                                 target_is_id_in_same_document=False),
     ])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER), root, para)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual(
         '<root>'
         '<p>'
         '<a href="target">title</a>'
         '</p>'
         '</root>', xml_string)
     self._assert_first_child__of_actual_is_same_object_as(root, ret_val)
Exemplo n.º 29
0
 def test_two_cross_reference(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([core.CrossReferenceText(StringText('title 1'),
                                               CrossReferenceTargetTestImpl('target 1')),
                       core.CrossReferenceText(StringText('title 2'),
                                               CrossReferenceTargetTestImpl('target 2'))])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER), root, para)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root>'
                      '<p>'
                      '<a href="#target 1">'
                      'title 1</a><br /><a href="#target 2">title 2'
                      '</a>'
                      '</p>'
                      '</root>',
                      xml_string)
     self._assert_first_child__of_actual_is_same_object_as(root, ret_val)
Exemplo n.º 30
0
 def test_single_anchor_with_cross_reference_as_anchored_text(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([
         core.AnchorText(core.CrossReferenceText(StringText('cross ref title'),
                                                 CrossReferenceTargetTestImpl('cross ref target'),
                                                 target_is_id_in_same_document=True),
                         CrossReferenceTargetTestImpl('anchor target')),
     ])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER), root, para,
                          skip_surrounding_p_element=True)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual('<root>'
                      '<span id="anchor target">'
                      '<a href="#cross ref target">cross ref title</a>'
                      '</span>'
                      '</root>',
                      xml_string)
     self.assertIs(root, ret_val)
Exemplo n.º 31
0
 def test_cross_reference_and_string(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([
         core.CrossReferenceText(StringText('title'),
                                 CrossReferenceTargetTestImpl('target'),
                                 target_is_id_in_same_document=True),
         core.StringText('string')
     ])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER),
                          root,
                          para,
                          skip_surrounding_p_element=True)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual(
         '<root>'
         '<a href="#target">title</a><br />string'
         '</root>', xml_string)
     self.assertIs(root, ret_val)
Exemplo n.º 32
0
 def test_two_cross_reference(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([
         core.CrossReferenceText(StringText('title 1'),
                                 CrossReferenceTargetTestImpl('target 1')),
         core.CrossReferenceText(StringText('title 2'),
                                 CrossReferenceTargetTestImpl('target 2'))
     ])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER), root, para)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual(
         '<root>'
         '<p>'
         '<a href="#target 1">'
         'title 1</a><br /><a href="#target 2">title 2'
         '</a>'
         '</p>'
         '</root>', xml_string)
     self._assert_first_child__of_actual_is_same_object_as(root, ret_val)
Exemplo n.º 33
0
 def test(self):
     cases = [
         Case('test_singleton_element_without_contents',
              items=[HeaderContentListItem(text('header'))],
              expected='<root>'
              '<dl>'
              '<dt>header</dt>'
              '</dl>'
              '</root>'),
         Case('test_singleton_element_with_multiple_content_paragraphs',
              items=[
                  HeaderContentListItem(
                      text('header'),
                      [para('ignored'), para('ignored')])
              ],
              expected='<root>'
              '<dl>'
              '<dt>header</dt>'
              '<dd>'
              '<p>every para text</p>'
              '<p>every para text</p>'
              '</dd>'
              '</dl>'
              '</root>'),
     ]
     for case in cases:
         with self.subTest(case.name):
             root = Element('root')
             the_list = HeaderContentList(case.items,
                                          Format(ListType.VARIABLE_LIST))
             # ACT #
             ret_val = sut.render(TextRenderer(TARGET_RENDERER),
                                  ConstantPRenderer('every para text'),
                                  root, the_list)
             # ASSERT #
             xml_string = as_unicode_str(root)
             self.assertEqual(case.expected, xml_string)
             self.assertIs(list(root)[0], ret_val)
Exemplo n.º 34
0
 def test_two_cross_reference(self):
     # ARRANGE #
     root = Element('root')
     para = Paragraph([
         core.CrossReferenceText(StringText('title 1'),
                                 CrossReferenceTargetTestImpl('target 1')),
         core.CrossReferenceText(StringText('title 2'),
                                 CrossReferenceTargetTestImpl('target 2'))
     ])
     # ACT #
     ret_val = sut.render(TextRenderer(TARGET_RENDERER),
                          root,
                          para,
                          skip_surrounding_p_element=True)
     # ASSERT #
     xml_string = as_unicode_str(root)
     self.assertEqual(
         '<root>'
         '<a href="#target 1">'
         'title 1</a><br /><a href="#target 2">title 2'
         '</a>'
         '</root>', xml_string)
     self.assertIs(root, ret_val)
Exemplo n.º 35
0
 def test_non_empty(self):
     # ARRANGE #
     cases = [
         Case(
             'test_singleton_element_without_contents',
             items=[HeaderContentListItem(text('header'))],
             expected='<root>'
             '<{L}><li>header</li></{L}>'
             '</root>',
         ),
         Case(
             'test_multiple_element_without_contents',
             items=[
                 HeaderContentListItem(text('header 1')),
                 HeaderContentListItem(text('header 2'))
             ],
             expected='<root>'
             '<{L}>'
             '<li>header 1</li>'
             '<li>header 2</li>'
             '</{L}>'
             '</root>',
         ),
         Case(
             'test_single_element_with_single_para_contents',
             items=[
                 HeaderContentListItem(text('header'), paras('ignored'))
             ],
             expected='<root>'
             '<{L}>'
             '<li>header<p>every para text</p></li>'
             '</{L}>'
             '</root>',
         ),
         Case(
             'test_single_element_with_multiple_para_contents',
             items=[
                 HeaderContentListItem(
                     text('header'),
                     [para('ignored'), para('ignored')])
             ],
             expected='<root>'
             '<{L}>'
             '<li>header'
             '<p>every para text</p>'
             '<p>every para text</p>'
             '</li>'
             '</{L}>'
             '</root>',
         ),
     ]
     for list_type, element in [(ListType.ITEMIZED_LIST, 'ul'),
                                (ListType.ORDERED_LIST, 'ol')]:
         for case in cases:
             with self.subTest(list_type=list_type, case=case.name):
                 root = Element('root')
                 the_list = HeaderContentList(case.items, Format(list_type))
                 # ACT #
                 ret_val = sut.render(TextRenderer(TARGET_RENDERER),
                                      ConstantPRenderer('every para text'),
                                      root, the_list)
                 # ASSERT #
                 expected = case.expected.format(L=element)
                 xml_string = as_unicode_str(root)
                 self.assertEqual(expected, xml_string)
                 self.assertIs(list(root)[0], ret_val)
Exemplo n.º 36
0
 def test_non_empty(self):
     # ARRANGE #
     cases = [
         Case('test_singleton_element_without_contents',
              items=
              [HeaderContentListItem(text('header'))],
              expected=
              '<root>'
              '<{L}><li>header</li></{L}>'
              '</root>',
              ),
         Case('test_multiple_element_without_contents',
              items=
              [HeaderContentListItem(text('header 1')),
               HeaderContentListItem(text('header 2'))],
              expected=
              '<root>'
              '<{L}>'
              '<li>header 1</li>'
              '<li>header 2</li>'
              '</{L}>'
              '</root>',
              ),
         Case('test_single_element_with_single_para_contents',
              items=
              [HeaderContentListItem(text('header'),
                                     paras('ignored'))],
              expected=
              '<root>'
              '<{L}>'
              '<li>header<p>every para text</p></li>'
              '</{L}>'
              '</root>',
              ),
         Case('test_single_element_with_multiple_para_contents',
              items=
              [HeaderContentListItem(text('header'),
                                     [para('ignored'),
                                      para('ignored')])],
              expected=
              '<root>'
              '<{L}>'
              '<li>header'
              '<p>every para text</p>'
              '<p>every para text</p>'
              '</li>'
              '</{L}>'
              '</root>',
              ),
     ]
     for list_type, element in [(ListType.ITEMIZED_LIST, 'ul'),
                                (ListType.ORDERED_LIST, 'ol')]:
         for case in cases:
             with self.subTest(list_type=list_type, case=case.name):
                 root = Element('root')
                 the_list = HeaderContentList(case.items, Format(list_type))
                 # ACT #
                 ret_val = sut.render(TextRenderer(TARGET_RENDERER),
                                      ConstantPRenderer('every para text'),
                                      root, the_list)
                 # ASSERT #
                 expected = case.expected.format(L=element)
                 xml_string = as_unicode_str(root)
                 self.assertEqual(expected,
                                  xml_string)
                 self.assertIs(list(root)[0],
                               ret_val)