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

Method check

Lib/test/test_pickle.py:158–168  ·  view source on GitHub ↗
(Pickler)

Source from the content-addressed store, hash-verified

156 @support.cpython_only
157 def test_pickler_reference_cycle(self):
158 def check(Pickler):
159 for proto in range(pickle.HIGHEST_PROTOCOL + 1):
160 f = io.BytesIO()
161 pickler = Pickler(f, proto)
162 pickler.dump('abc')
163 self.assertEqual(self.loads(f.getvalue()), 'abc')
164 pickler = Pickler(io.BytesIO())
165 self.assertEqual(pickler.persistent_id('def'), 'def')
166 r = weakref.ref(pickler)
167 del pickler
168 self.assertIsNone(r())
169
170 class PersPickler(self.pickler):
171 def persistent_id(subself, obj):

Callers

nothing calls this directly

Calls 12

getvalueMethod · 0.95
PicklerClass · 0.90
UnpicklerClass · 0.85
assertIsNoneMethod · 0.80
rFunction · 0.50
dumpMethod · 0.45
assertEqualMethod · 0.45
loadsMethod · 0.45
persistent_idMethod · 0.45
dumpsMethod · 0.45
loadMethod · 0.45
persistent_loadMethod · 0.45

Tested by

no test coverage detected