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

Method _test_recursive_dict

Lib/test/pickletester.py:2674–2684  ·  view source on GitHub ↗
(self, cls, asdict=identity, minprotocol=0)

Source from the content-addressed store, hash-verified

2672 self._test_recursive_tuple_and_list(REX_six, aslist=lambda x: x.items)
2673
2674 def _test_recursive_dict(self, cls, asdict=identity, minprotocol=0):
2675 # Dict containing itself.
2676 d = cls()
2677 d[1] = d
2678 for proto in range(minprotocol, pickle.HIGHEST_PROTOCOL + 1):
2679 s = self.dumps(d, proto)
2680 x = self.loads(s)
2681 self.assertIsInstance(x, cls)
2682 y = asdict(x)
2683 self.assertEqual(list(y.keys()), [1])
2684 self.assertIs(y[1], x)
2685
2686 def test_recursive_dict(self):
2687 self._test_recursive_dict(dict)

Callers 3

test_recursive_dictMethod · 0.95

Calls 9

asdictFunction · 0.85
listClass · 0.85
assertIsInstanceMethod · 0.80
clsClass · 0.50
dumpsMethod · 0.45
loadsMethod · 0.45
assertEqualMethod · 0.45
keysMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected