|
|
@@ -1,4 +1,5 @@
|
|
|
-from direct.stdpy.pickle import dumps, loads
|
|
|
+from direct.stdpy.pickle import dumps, loads, PicklingError
|
|
|
+import pytest
|
|
|
|
|
|
|
|
|
def test_reduce_persist():
|
|
|
@@ -9,3 +10,12 @@ def test_reduce_persist():
|
|
|
|
|
|
parent2, child2 = loads(dumps([parent, child]))
|
|
|
assert tuple(parent2.children) == (child2,)
|
|
|
+
|
|
|
+
|
|
|
+def test_pickle_error():
|
|
|
+ class ErroneousPickleable(object):
|
|
|
+ def __reduce__(self):
|
|
|
+ return 12345
|
|
|
+
|
|
|
+ with pytest.raises(PicklingError):
|
|
|
+ dumps(ErroneousPickleable())
|