aboutsummaryrefslogtreecommitdiff
path: root/tests/test_map.py
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2018-11-19 22:29:06 -0500
committerYury Selivanov <yury@magic.io>2018-11-20 14:25:07 -0500
commit4276e0c82cb0c2f7f7858063a2fe8bdd8b4240cf (patch)
treeafc743c58513a175503676c2dbda0b2bae73b35e /tests/test_map.py
parenta9dc2d83794a9cada687f6b92609fe6ef16c2bb9 (diff)
downloadimmutables-4276e0c82cb0c2f7f7858063a2fe8bdd8b4240cf.tar.gz
immutables-4276e0c82cb0c2f7f7858063a2fe8bdd8b4240cf.zip
Implement pickle support
Diffstat (limited to 'tests/test_map.py')
-rw-r--r--tests/test_map.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_map.py b/tests/test_map.py
index 13c6cb1..bbf0a52 100644
--- a/tests/test_map.py
+++ b/tests/test_map.py
@@ -1,5 +1,6 @@
import collections.abc
import gc
+import pickle
import random
import unittest
import weakref
@@ -1148,6 +1149,15 @@ class BaseMapTest:
self.assertEqual(dict(h.items()), d)
self.assertEqual(len(h), len(d))
+ def test_map_pickle(self):
+ h = self.Map(a=1, b=2)
+ for proto in range(pickle.HIGHEST_PROTOCOL):
+ p = pickle.dumps(h, proto)
+ uh = pickle.loads(p)
+
+ self.assertTrue(isinstance(uh, self.Map))
+ self.assertEqual(h, uh)
+
class PyMapTest(BaseMapTest, unittest.TestCase):