summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-01-12 11:14:27 (GMT)
committerGitHub <noreply@github.com>2023-01-12 11:14:27 (GMT)
commit47b1eb9784bd828a5b6541f37c3e1a4b4eb80729 (patch)
tree151e0287884c3079156d12fbb3026121352ae27a /Lib/test
parentebc1fd3795971b843ba871f4d9c8330c2bf6a57b (diff)
downloadcpython-47b1eb9784bd828a5b6541f37c3e1a4b4eb80729.zip
cpython-47b1eb9784bd828a5b6541f37c3e1a4b4eb80729.tar.gz
cpython-47b1eb9784bd828a5b6541f37c3e1a4b4eb80729.tar.bz2
[3.10] gh-100931: Test all `pickle` protocols in `test_slice` (GH-100932). (GH-100978)
(cherry picked from commit 8795ad1bd0d6ee031543fcaf5a86a60b37950714) Co-authored-by: Nikita Sobolev <mail@sobolevn.me> Automerge-Triggered-By: GH:AlexWaygood
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_slice.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_slice.py b/Lib/test/test_slice.py
index 584e5c7..03fde32 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))