Skip to content

Commit

Permalink
[3.11] pythongh-100931: Test all pickle protocols in test_slice (p…
Browse files Browse the repository at this point in the history
…ythonGH-100932). (pythonGH-100979)

(cherry picked from commit 8795ad1)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>

Automerge-Triggered-By: GH:AlexWaygood
  • Loading branch information
sobolevn authored Jan 12, 2023
1 parent db26437 commit cb6ff54
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Lib/test/test_slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,10 @@ def __setitem__(self, i, k):
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))
Expand Down

0 comments on commit cb6ff54

Please sign in to comment.