diff options
Diffstat (limited to 'Lib/test/test_deque.py')
-rw-r--r-- | Lib/test/test_deque.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Lib/test/test_deque.py b/Lib/test/test_deque.py index f0afe1d..a8487d2 100644 --- a/Lib/test/test_deque.py +++ b/Lib/test/test_deque.py @@ -472,6 +472,19 @@ class TestBasic(unittest.TestCase): ## self.assertNotEqual(id(d), id(e)) ## self.assertEqual(id(e), id(e[-1])) + def test_iterator_pickle(self): + data = deque(range(200)) + it = itorg = iter(data) + d = pickle.dumps(it) + it = pickle.loads(d) + self.assertEqual(type(itorg), type(it)) + self.assertEqual(list(it), list(data)) + + it = pickle.loads(d) + next(it) + d = pickle.dumps(it) + self.assertEqual(list(it), list(data)[1:]) + def test_deepcopy(self): mut = [10] d = deque([mut]) @@ -524,7 +537,7 @@ class TestBasic(unittest.TestCase): @support.cpython_only def test_sizeof(self): BLOCKLEN = 62 - basesize = support.calcobjsize('2P4PlP') + basesize = support.calcobjsize('2P4nlP') blocksize = struct.calcsize('2P%dP' % BLOCKLEN) self.assertEqual(object.__sizeof__(deque()), basesize) check = self.check_sizeof |