diff options
Diffstat (limited to 'Lib/test/test_enumerate.py')
-rw-r--r-- | Lib/test/test_enumerate.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/Lib/test/test_enumerate.py b/Lib/test/test_enumerate.py index 8742afc..e85254c 100644 --- a/Lib/test/test_enumerate.py +++ b/Lib/test/test_enumerate.py @@ -66,20 +66,21 @@ class N: class PickleTest: # Helper to check picklability def check_pickle(self, itorg, seq): - d = pickle.dumps(itorg) - it = pickle.loads(d) - self.assertEqual(type(itorg), type(it)) - self.assertEqual(list(it), seq) - - it = pickle.loads(d) - try: - next(it) - except StopIteration: - self.assertFalse(seq[1:]) - return - d = pickle.dumps(it) - it = pickle.loads(d) - self.assertEqual(list(it), seq[1:]) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + d = pickle.dumps(itorg, proto) + it = pickle.loads(d) + self.assertEqual(type(itorg), type(it)) + self.assertEqual(list(it), seq) + + it = pickle.loads(d) + try: + next(it) + except StopIteration: + self.assertFalse(seq[1:]) + continue + d = pickle.dumps(it, proto) + it = pickle.loads(d) + self.assertEqual(list(it), seq[1:]) class EnumerateTestCase(unittest.TestCase, PickleTest): |