Skip to content

Commit cb6ff54

Browse files
authored
[3.11] gh-100931: Test all pickle protocols in test_slice (GH-100932). (GH-100979)
(cherry picked from commit 8795ad1) Co-authored-by: Nikita Sobolev <[email protected]> Automerge-Triggered-By: GH:AlexWaygood
1 parent db26437 commit cb6ff54

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/test/test_slice.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,10 @@ def __setitem__(self, i, k):
236236
self.assertEqual(tmp, [(slice(1, 2), 42)])
237237

238238
def test_pickle(self):
239+
import pickle
240+
239241
s = slice(10, 20, 3)
240-
for protocol in (0,1,2):
242+
for protocol in range(pickle.HIGHEST_PROTOCOL + 1):
241243
t = loads(dumps(s, protocol))
242244
self.assertEqual(s, t)
243245
self.assertEqual(s.indices(15), t.indices(15))

0 commit comments

Comments
 (0)