8000 [3.11] gh-100931: Test all `pickle` protocols in `test_slice` (GH-100… · sobolevn/cpython@e52d37b · GitHub
[go: up one dir, main page]

Skip to content

Commit e52d37b

Browse files
committed
[3.11] pythongh-100931: Test all pickle protocols in test_slice (pythonGH-100932).
(cherry picked from commit 8795ad1) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
1 parent e8097d4 commit e52d37b

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
@@ -235,8 +235,10 @@ def __setitem__(self, i, k):
235235
self.assertEqual(tmp, [(slice(1, 2), 42)])
236236

237237
def test_pickle(self):
238+
import pickle
239+
238240
s = slice(10, 20, 3)
239-
for protocol in (0,1,2):
241+
for protocol in range(pickle.HIGHEST_PROTOCOL + 1):
240242
t = loads(dumps(s, protocol))
241243
self.assertEqual(s, t)
242244
self.assertEqual(s.indices(15), t.indices(15))

0 commit comments

Comments
 (0)
0