diff options
author | Yury Selivanov <yury@magic.io> | 2018-11-19 22:29:06 -0500 |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2018-11-20 14:25:07 -0500 |
commit | 4276e0c82cb0c2f7f7858063a2fe8bdd8b4240cf (patch) | |
tree | afc743c58513a175503676c2dbda0b2bae73b35e /tests | |
parent | a9dc2d83794a9cada687f6b92609fe6ef16c2bb9 (diff) | |
download | immutables-4276e0c82cb0c2f7f7858063a2fe8bdd8b4240cf.tar.gz immutables-4276e0c82cb0c2f7f7858063a2fe8bdd8b4240cf.zip |
Implement pickle support
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_map.py | 10 |
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): |