MCPcopy
hub / github.com/django/django / is_pickable

Function is_pickable

django/test/testcases.py:82–91  ·  view source on GitHub ↗

Returns true if the object can be dumped and loaded through the pickle module.

(obj)

Source from the content-addressed store, hash-verified

80
81
82def is_pickable(obj):
83 """
84 Returns true if the object can be dumped and loaded through the pickle
85 module.
86 """
87 try:
88 pickle.loads(pickle.dumps(obj))
89 except (AttributeError, TypeError, pickle.PickleError):
90 return False
91 return True
92
93
94def assert_and_parse_html(self, html, user_msg, msg):

Callers 2

__getstate__Method · 0.85

Calls 2

loadsMethod · 0.45
dumpsMethod · 0.45

Tested by

no test coverage detected