From 4276e0c82cb0c2f7f7858063a2fe8bdd8b4240cf Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Mon, 19 Nov 2018 22:29:06 -0500 Subject: Implement pickle support --- tests/test_map.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') 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): -- cgit v1.2.3