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

Method test_corners

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

Source from the content-addressed store, hash-verified

3632 self.assertEqual(''.join(doc.itertext()), 'a&b&c&')
3633
3634 def test_corners(self):
3635 # single root, no subelements
3636 a = ET.Element('a')
3637 self.assertEqual(self._ilist(a), ['a'])
3638
3639 # one child
3640 b = ET.SubElement(a, 'b')
3641 self.assertEqual(self._ilist(a), ['a', 'b'])
3642
3643 # one child and one grandchild
3644 c = ET.SubElement(b, 'c')
3645 self.assertEqual(self._ilist(a), ['a', 'b', 'c'])
3646
3647 # two children, only first with grandchild
3648 d = ET.SubElement(a, 'd')
3649 self.assertEqual(self._ilist(a), ['a', 'b', 'c', 'd'])
3650
3651 # replace first child by second
3652 a[0] = a[1]
3653 del a[1]
3654 self.assertEqual(self._ilist(a), ['a', 'd'])
3655
3656 def test_iter_by_tag(self):
3657 doc = ET.XML('''

Callers

nothing calls this directly

Calls 2

_ilistMethod · 0.95
assertEqualMethod · 0.45

Tested by

no test coverage detected