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

Method test_pickle

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

Source from the content-addressed store, hash-verified

2727 self.assertEqual(e1.get('w', default=7), 7)
2728
2729 def test_pickle(self):
2730 # issue #16076: the C implementation wasn't pickleable.
2731 for proto in range(2, pickle.HIGHEST_PROTOCOL + 1):
2732 for dumper, loader in product(self.modules, repeat=2):
2733 e = dumper.Element('foo', bar=42)
2734 e.text = "text goes here"
2735 e.tail = "opposite of head"
2736 dumper.SubElement(e, 'child').append(dumper.Element('grandchild'))
2737 e.append(dumper.Element('child'))
2738 e.findall('.//grandchild')[0].set('attr', 'other value')
2739
2740 e2 = self.pickleRoundTrip(e, 'xml.etree.ElementTree',
2741 dumper, loader, proto)
2742
2743 self.assertEqual(e2.tag, 'foo')
2744 self.assertEqual(e2.attrib['bar'], 42)
2745 self.assertEqual(len(e2), 2)
2746 self.assertEqualElements(e, e2)
2747
2748 def test_pickle_issue18997(self):
2749 for proto in range(2, pickle.HIGHEST_PROTOCOL + 1):

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected