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

Method test_treebuilder_pi

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

Source from the content-addressed store, hash-verified

3709 self.assertEqual(b.comment('ctext'), len('ctext'))
3710
3711 def test_treebuilder_pi(self):
3712 b = ET.TreeBuilder()
3713 self.assertEqual(b.pi('target', None).tag, ET.PI)
3714 self.assertEqual(b.pi('target', None).text, 'target')
3715
3716 b = ET.TreeBuilder(pi_factory=ET.PI)
3717 self.assertEqual(b.pi('target').tag, ET.PI)
3718 self.assertEqual(b.pi('target').text, "target")
3719 self.assertEqual(b.pi('pitarget', ' text ').tag, ET.PI)
3720 self.assertEqual(b.pi('pitarget', ' text ').text, "pitarget text ")
3721
3722 b = ET.TreeBuilder(pi_factory=lambda target, text: (len(target), text))
3723 self.assertEqual(b.pi('target'), (len('target'), None))
3724 self.assertEqual(b.pi('pitarget', ' text '), (len('pitarget'), ' text '))
3725
3726 def test_late_tail(self):
3727 # Issue #37399: The tail of an ignored comment could overwrite the text before it.

Callers

nothing calls this directly

Calls 3

piMethod · 0.95
lenFunction · 0.85
assertEqualMethod · 0.45

Tested by

no test coverage detected