Skip to content

Commit

Permalink
[3.10] gh-100931: Test all pickle protocols in test_slice (GH-100932
Browse files Browse the repository at this point in the history
). (GH-100978)

(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 ebc1fd3 commit 47b1eb9
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 47b1eb9

Please sign in to comment.