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

Method test_corners

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

Source from the content-addressed store, hash-verified

3591 self.assertEqual(''.join(doc.itertext()), 'a&b&c&')
3592
3593 def test_corners(self):
3594 # single root, no subelements
3595 a = ET.Element('a')
3596 self.assertEqual(self._ilist(a), ['a'])
3597
3598 # one child
3599 b = ET.SubElement(a, 'b')
3600 self.assertEqual(self._ilist(a), ['a', 'b'])
3601
3602 # one child and one grandchild
3603 c = ET.SubElement(b, 'c')
3604 self.assertEqual(self._ilist(a), ['a', 'b', 'c'])
3605
3606 # two children, only first with grandchild
3607 d = ET.SubElement(a, 'd')
3608 self.assertEqual(self._ilist(a), ['a', 'b', 'c', 'd'])
3609
3610 # replace first child by second
3611 a[0] = a[1]
3612 del a[1]
3613 self.assertEqual(self._ilist(a), ['a', 'd'])
3614
3615 def test_iter_by_tag(self):
3616 doc = ET.XML('''

Callers

nothing calls this directly

Calls 2

_ilistMethod · 0.95
assertEqualMethod · 0.45

Tested by

no test coverage detected