MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_writefile

Method test_writefile

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

Source from the content-addressed store, hash-verified

578 self.assertEqual(ids["body"].tag, 'body')
579
580 def test_writefile(self):
581 elem = ET.Element("tag")
582 elem.text = "text"
583 self.serialize_check(elem, '<tag>text</tag>')
584 ET.SubElement(elem, "subtag").text = "subtext"
585 self.serialize_check(elem, '<tag>text<subtag>subtext</subtag></tag>')
586
587 # Test tag suppression
588 elem.tag = None
589 self.serialize_check(elem, 'text<subtag>subtext</subtag>')
590 elem.insert(0, ET.Comment("comment"))
591 self.serialize_check(elem,
592 'text<!--comment--><subtag>subtext</subtag>') # assumes 1.3
593
594 elem[0] = ET.PI("key", "value")
595 self.serialize_check(elem, 'text<?key value?><subtag>subtext</subtag>')
596
597 @unittest.expectedFailure # TODO: RUSTPYTHON
598 def test_custom_builder(self):

Callers

nothing calls this directly

Calls 2

serialize_checkMethod · 0.95
insertMethod · 0.95

Tested by

no test coverage detected