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

Method check

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

Source from the content-addressed store, hash-verified

228 @support.cpython_only
229 def test_pickler_reference_cycle(self):
230 def check(Pickler):
231 for proto in range(pickle.HIGHEST_PROTOCOL + 1):
232 f = io.BytesIO()
233 pickler = Pickler(f, proto)
234 pickler.dump('abc')
235 self.assertEqual(self.loads(f.getvalue()), 'abc')
236 pickler = Pickler(io.BytesIO())
237 self.assertEqual(pickler.persistent_id('def'), 'def')
238 r = weakref.ref(pickler)
239 del pickler
240 self.assertIsNone(r())
241
242 class PersPickler(self.pickler):
243 def persistent_id(subself, obj):

Callers

nothing calls this directly

Calls 11

getvalueMethod · 0.95
PicklerClass · 0.90
UnpicklerClass · 0.85
assertIsNoneMethod · 0.80
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