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

Method test_pickle

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

Source from the content-addressed store, hash-verified

2761 self.assertEqual(e1.get('w', default=7), 7)
2762
2763 def test_pickle(self):
2764 # issue #16076: the C implementation wasn't pickleable.
2765 for proto in range(2, pickle.HIGHEST_PROTOCOL + 1):
2766 for dumper, loader in product(self.modules, repeat=2):
2767 e = dumper.Element('foo', bar=42)
2768 e.text = "text goes here"
2769 e.tail = "opposite of head"
2770 dumper.SubElement(e, 'child').append(dumper.Element('grandchild'))
2771 e.append(dumper.Element('child'))
2772 e.findall('.//grandchild')[0].set('attr', 'other value')
2773
2774 e2 = self.pickleRoundTrip(e, 'xml.etree.ElementTree',
2775 dumper, loader, proto)
2776
2777 self.assertEqual(e2.tag, 'foo')
2778 self.assertEqual(e2.attrib['bar'], 42)
2779 self.assertEqual(len(e2), 2)
2780 self.assertEqualElements(e, e2)
2781
2782 def test_pickle_issue18997(self):
2783 for proto in range(2, pickle.HIGHEST_PROTOCOL + 1):

Callers

nothing calls this directly

Calls 7

appendMethod · 0.95
findallMethod · 0.95
pickleRoundTripMethod · 0.80
assertEqualElementsMethod · 0.80
appendMethod · 0.45
setMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected