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

Method test_parseliteral

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

Source from the content-addressed store, hash-verified

587 '</root>')
588
589 def test_parseliteral(self):
590 element = ET.XML("<html><body>text</body></html>")
591 self.assertEqual(ET.tostring(element, encoding='unicode'),
592 '<html><body>text</body></html>')
593 element = ET.fromstring("<html><body>text</body></html>")
594 self.assertEqual(ET.tostring(element, encoding='unicode'),
595 '<html><body>text</body></html>')
596 sequence = ["<html><body>", "text</bo", "dy></html>"]
597 element = ET.fromstringlist(sequence)
598 self.assertEqual(ET.tostring(element),
599 b'<html><body>text</body></html>')
600 self.assertEqual(b"".join(ET.tostringlist(element)),
601 b'<html><body>text</body></html>')
602 self.assertEqual(ET.tostring(element, "ascii"),
603 b"<?xml version='1.0' encoding='ascii'?>\n"
604 b"<html><body>text</body></html>")
605 _, ids = ET.XMLID("<html><body>text</body></html>")
606 self.assertEqual(len(ids), 0)
607 _, ids = ET.XMLID("<html><body id='body'>text</body></html>")
608 self.assertEqual(len(ids), 1)
609 self.assertEqual(ids["body"].tag, 'body')
610
611 def test_writefile(self):
612 elem = ET.Element("tag")

Callers

nothing calls this directly

Calls 3

assertEqualMethod · 0.45
fromstringMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected