diff tests/test_fastpickle.py @ 717:fcfbe103cfd1

internal: Fix some bugs with the `fastpickle` module.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 28 May 2016 15:41:05 -0700
parents 298f8f46432a
children 8adc27285d93
line wrap: on
line diff
--- a/tests/test_fastpickle.py	Thu May 26 20:45:34 2016 -0700
+++ b/tests/test_fastpickle.py	Sat May 28 15:41:05 2016 -0700
@@ -1,6 +1,6 @@
 import datetime
 import pytest
-from piecrust.fastpickle import pickle, unpickle
+from piecrust.fastpickle import pickle, unpickle, pickle_obj, unpickle_obj
 
 
 class Foo(object):
@@ -51,3 +51,14 @@
     for i in range(2):
         assert f.bars[i].value == o.bars[i].value
 
+
+def test_reentrance():
+    a = {'test_ints': 42, 'test_set': set([1, 2])}
+    data = pickle_obj(a)
+    b = unpickle_obj(data)
+    assert a == b
+    other_b = unpickle_obj(data)
+    assert a == other_b
+    c = unpickle_obj(data)
+    assert a == c
+