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

Method test_pickle_recursive

Lib/test/test_ordered_dict.py:361–372  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

359 self.assertEqual(od.__reduce__()[2], {'x': 10})
360
361 def test_pickle_recursive(self):
362 OrderedDict = self.OrderedDict
363 od = OrderedDict()
364 od[1] = od
365
366 # pickle directly pulls the module, so we have to fake it
367 with replaced_module('collections', self.module):
368 for proto in range(-1, pickle.HIGHEST_PROTOCOL + 1):
369 dup = pickle.loads(pickle.dumps(od, proto))
370 self.assertIsNot(dup, od)
371 self.assertEqual(list(dup.keys()), [1])
372 self.assertIs(dup[1], dup)
373
374 def test_repr(self):
375 OrderedDict = self.OrderedDict

Callers

nothing calls this directly

Calls 9

listClass · 0.85
assertIsNotMethod · 0.80
OrderedDictClass · 0.70
replaced_moduleFunction · 0.70
loadsMethod · 0.45
dumpsMethod · 0.45
assertEqualMethod · 0.45
keysMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected