MCPcopy Create free account
hub / github.com/dateutil/dateutil / assertPicklable

Method assertPicklable

tests/_common.py:32–46  ·  view source on GitHub ↗

Assert that an object can be pickled and unpickled. This assertion assumes that the desired behavior is that the unpickled object compares equal to the original object, but is not the same object.

(self, obj, singleton=False, asfile=False,
                        dump_kwargs=None, load_kwargs=None)

Source from the content-addressed store, hash-verified

30 return nobj
31
32 def assertPicklable(self, obj, singleton=False, asfile=False,
33 dump_kwargs=None, load_kwargs=None):
34 """
35 Assert that an object can be pickled and unpickled. This assertion
36 assumes that the desired behavior is that the unpickled object compares
37 equal to the original object, but is not the same object.
38 """
39 get_nobj = self._get_nobj_file if asfile else self._get_nobj_bytes
40 dump_kwargs = dump_kwargs or {}
41 load_kwargs = load_kwargs or {}
42
43 nobj = get_nobj(obj, dump_kwargs, load_kwargs)
44 if not singleton:
45 self.assertIsNot(obj, nobj)
46 self.assertEqual(obj, nobj)
47
48
49class TZContextBase(object):

Callers 11

testPickleTzUTCMethod · 0.80
testPickleTzOffsetPosMethod · 0.80
testPickleTzOffsetNegMethod · 0.80
testPickleTzLocalMethod · 0.80
testPickleTzICalMethod · 0.80
testPickleTzGettzMethod · 0.80

Calls

no outgoing calls

Tested by 11

testPickleTzUTCMethod · 0.64
testPickleTzOffsetPosMethod · 0.64
testPickleTzOffsetNegMethod · 0.64
testPickleTzLocalMethod · 0.64
testPickleTzICalMethod · 0.64
testPickleTzGettzMethod · 0.64