MCPcopy Create free account
hub / github.com/python/cpython / test_unpickler_super

Method test_unpickler_super

Lib/test/test_pickle.py:253–265  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

251 self.assertEqual(self.loads(f.getvalue()), 'abc')
252
253 def test_unpickler_super(self):
254 class PersUnpickler(self.unpickler):
255 def persistent_load(subself, pid):
256 called.append(pid)
257 with self.assertRaises(self.persistent_load_error):
258 super().persistent_load(pid)
259 return pid
260
261 for proto in range(pickle.HIGHEST_PROTOCOL + 1):
262 unpickler = PersUnpickler(io.BytesIO(self.dumps('abc', proto)))
263 called = []
264 self.assertEqual(unpickler.load(), 'abc')
265 self.assertEqual(called, ['abc'])
266
267 def test_pickler_instance_attribute(self):
268 def persistent_id(obj):

Callers

nothing calls this directly

Calls 4

PersUnpicklerClass · 0.70
dumpsMethod · 0.45
assertEqualMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected