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

Method test_lost_tail

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

Source from the content-addressed store, hash-verified

2506 self.assertEqual(e.text, 'changed')
2507
2508 def test_lost_tail(self):
2509 # Issue #25902: Borrowed tail can disappear
2510 class Text:
2511 def __bool__(self):
2512 e[0].tail = 'changed'
2513 return True
2514
2515 e = ET.Element('root')
2516 e.append(ET.Element('tag'))
2517 e[0].tail = Text()
2518 i = e.itertext()
2519 t = next(i)
2520 self.assertIsInstance(t, Text)
2521 self.assertIsInstance(e[0].tail, str)
2522 self.assertEqual(e[0].tail, 'changed')
2523
2524 def test_lost_elem(self):
2525 # Issue #25902: Borrowed element can disappear

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected