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

Method test_lost_text

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

Source from the content-addressed store, hash-verified

2491 ET.register_namespace('test10777', 'http://myuri/')
2492
2493 def test_lost_text(self):
2494 # Issue #25902: Borrowed text can disappear
2495 class Text:
2496 def __bool__(self):
2497 e.text = 'changed'
2498 return True
2499
2500 e = ET.Element('tag')
2501 e.text = Text()
2502 i = e.itertext()
2503 t = next(i)
2504 self.assertIsInstance(t, Text)
2505 self.assertIsInstance(e.text, str)
2506 self.assertEqual(e.text, 'changed')
2507
2508 def test_lost_tail(self):
2509 # Issue #25902: Borrowed tail can disappear

Callers

nothing calls this directly

Calls 4

itertextMethod · 0.95
assertIsInstanceMethod · 0.80
TextClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected