Example #1
0
 def test_should_correct_closing_tag_with_ns(self):
     xml_str = (
         '<tei xmlns="http://www.tei-c.org/ns/1.0"><text><figure>abc</p></text></tei>'
     )
     expected_xml_str = (
         '<tei xmlns="http://www.tei-c.org/ns/1.0"><text><figure>abc</figure></text></tei>'
     )
     assert get_fixed_xml_str(xml_str) == expected_xml_str
Example #2
0
 def test_should_correct_closing_tag_and_decode_apos_in_data(self):
     xml_str = (
         '<tei><text><figure a="1" b="2">a &apos; b</p></text></tei>')
     expected_xml_str = (
         '<tei><text><figure a="1" b="2">a \' b</figure></text></tei>')
     assert get_fixed_xml_str(xml_str) == expected_xml_str
Example #3
0
 def test_should_correct_closing_tag_and_escape_gt_in_data(self):
     xml_str = ('<tei><text><figure a="1" b="2">a &gt; b</p></text></tei>')
     expected_xml_str = (
         '<tei><text><figure a="1" b="2">a &gt; b</figure></text></tei>')
     assert get_fixed_xml_str(xml_str) == expected_xml_str
Example #4
0
 def test_should_correct_closing_tag_with_attributes(self):
     xml_str = ('<tei><text><figure a="1" b="2">abc</p></text></tei>')
     expected_xml_str = (
         '<tei><text><figure a="1" b="2">abc</figure></text></tei>')
     assert get_fixed_xml_str(xml_str) == expected_xml_str
Example #5
0
 def test_should_close_unclosed_tag(self):
     xml_str = ('<tei><text><figure>abc</text></tei>')
     expected_xml_str = ('<tei><text><figure>abc</figure></text></tei>')
     assert get_fixed_xml_str(xml_str) == expected_xml_str
Example #6
0
 def test_should_correct_multiple_single_closing_tag(self):
     xml_str = ('<tei><text><figure>abc</p><figure>abc</p></text></tei>')
     expected_xml_str = (
         '<tei><text><figure>abc</figure><figure>abc</figure></text></tei>')
     assert get_fixed_xml_str(xml_str) == expected_xml_str
Example #7
0
 def test_should_preserve_valid_xml_with_ns(self):
     xml_str = '<tei xmlns="http://www.tei-c.org/ns/1.0"><text>abc</text></tei>'
     assert get_fixed_xml_str(xml_str) == xml_str
Example #8
0
 def test_should_preserve_valid_xml_without_ns(self):
     xml_str = '<tei><text>abc</text></tei>'
     assert get_fixed_xml_str(xml_str) == xml_str
Example #9
0
 def test_should_correct_closing_tag_and_escape_amp_in_attrib(self):
     xml_str = ('<tei><text><figure a="1 &amp; 2">abc</p></text></tei>')
     expected_xml_str = (
         '<tei><text><figure a="1 &amp; 2">abc</figure></text></tei>')
     assert get_fixed_xml_str(xml_str) == expected_xml_str