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

Method test_custom_incomplete_deserializer

Lib/test/test_shelve.py:248–262  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

246 s["foo"] = "bar"
247
248 def test_custom_incomplete_deserializer(self):
249 os.mkdir(self.dirname)
250 self.addCleanup(os_helper.rmtree, self.dirname)
251
252 def serializer(obj, protocol=None):
253 return type(obj).__name__.encode("utf-8")
254
255 def deserializer(data):
256 pass
257
258 with shelve.open(self.fn, serializer=serializer,
259 deserializer=deserializer) as s:
260 s["foo"] = "bar"
261 self.assertNotEqual(s["foo"], "bar")
262 self.assertIsNone(s["foo"])
263
264 def test_custom_serializer_and_deserializer_bsd_db_shelf(self):
265 berkeleydb = import_helper.import_module("berkeleydb")

Callers

nothing calls this directly

Calls 5

addCleanupMethod · 0.95
assertNotEqualMethod · 0.95
assertIsNoneMethod · 0.95
mkdirMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected