From cb6ff54b01118e01c26758d2f57cf6da60277bd4 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Thu, 12 Jan 2023 14:24:09 +0300 Subject: [PATCH] [3.11] gh-100931: Test all `pickle` protocols in `test_slice` (GH-100932). (GH-100979) (cherry picked from commit 8795ad1bd0d6ee031543fcaf5a86a60b37950714) Co-authored-by: Nikita Sobolev Automerge-Triggered-By: GH:AlexWaygood --- Lib/test/test_slice.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py index 584e5c7f17c2..03fde3275e14 100644 --- a/Lib/test/test_slice.py +++ b/Lib/test/test_slice.py @@ -236,8 +236,10 @@ class SliceTest(unittest.TestCase): self.assertEqual(tmp, [(slice(1, 2), 42)]) def test_pickle(self): + import pickle + s = slice(10, 20, 3) - for protocol in (0,1,2): + for protocol in range(pickle.HIGHEST_PROTOCOL + 1): t = loads(dumps(s, protocol)) self.assertEqual(s, t) self.assertEqual(s.indices(15), t.indices(15)) -- 2.47.3