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

Method test_pickler_super

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

Source from the content-addressed store, hash-verified

236 check(PersUnpickler)
237
238 def test_pickler_super(self):
239 class PersPickler(self.pickler):
240 def persistent_id(subself, obj):
241 called.append(obj)
242 self.assertIsNone(super().persistent_id(obj))
243 return obj
244
245 for proto in range(pickle.HIGHEST_PROTOCOL + 1):
246 f = io.BytesIO()
247 pickler = PersPickler(f, proto)
248 called = []
249 pickler.dump('abc')
250 self.assertEqual(called, ['abc'])
251 self.assertEqual(self.loads(f.getvalue()), 'abc')
252
253 def test_unpickler_super(self):
254 class PersUnpickler(self.unpickler):

Callers

nothing calls this directly

Calls 5

getvalueMethod · 0.95
PersPicklerClass · 0.70
dumpMethod · 0.45
assertEqualMethod · 0.45
loadsMethod · 0.45

Tested by

no test coverage detected