Пример #1
0
 def test_writer(self):
     a = Element('a')
     b = SubElement(a, 'b')
     b.append(Comment('a comment'))
     c = SubElement(b, 'c', d = 'e')
     f = SubElement(c, 'f')
     f.text = 'g'
     h = SubElement(c, 'h')
     h.text = 'i << >> << &&'
     b.append(ProcessingInstruction('pdk', 'processing instruction'))
     tree = ElementTree(a)
     output = stringio()
     write_pretty_xml(tree, output)
     self.assert_equals_long(expected_xml_output, output.getvalue())
Пример #2
0
 def test_writer(self):
     a = Element('a')
     b = SubElement(a, 'b')
     b.append(Comment('a comment'))
     c = SubElement(b, 'c', d = 'e')
     f = SubElement(c, 'f')
     f.text = 'g'
     h = SubElement(c, 'h')
     h.text = 'i << >> << &&'
     b.append(ProcessingInstruction('pdk', 'processing instruction'))
     tree = ElementTree(a)
     output = stringio()
     write_pretty_xml(tree, output)
     self.assert_equals_long(expected_xml_output, output.getvalue())
Пример #3
0
 def test_xml_read_then_write(self):
     tree = parse_xml(stringio(expected_xml_output))
     output = stringio()
     write_pretty_xml(tree, output)
     self.assert_equals_long(expected_xml_output, output.getvalue())
Пример #4
0
 def test_xml_read_then_write(self):
     tree = parse_xml(stringio(expected_xml_output))
     output = stringio()
     write_pretty_xml(tree, output)
     self.assert_equals_long(expected_xml_output, output.getvalue())