MCPcopy Index your code
hub / github.com/python/cpython / test_writefile

Method test_writefile

Lib/test/test_xml_etree.py:611–626  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

609 self.assertEqual(ids["body"].tag, 'body')
610
611 def test_writefile(self):
612 elem = ET.Element("tag")
613 elem.text = "text"
614 self.serialize_check(elem, '<tag>text</tag>')
615 ET.SubElement(elem, "subtag").text = "subtext"
616 self.serialize_check(elem, '<tag>text<subtag>subtext</subtag></tag>')
617
618 # Test tag suppression
619 elem.tag = None
620 self.serialize_check(elem, 'text<subtag>subtext</subtag>')
621 elem.insert(0, ET.Comment("comment"))
622 self.serialize_check(elem,
623 'text<!--comment--><subtag>subtext</subtag>') # assumes 1.3
624
625 elem[0] = ET.PI("key", "value")
626 self.serialize_check(elem, 'text<?key value?><subtag>subtext</subtag>')
627
628 def test_custom_builder(self):
629 # Test parser w. custom builder.

Callers

nothing calls this directly

Calls 2

serialize_checkMethod · 0.95
insertMethod · 0.95

Tested by

no test coverage detected