Kaydet (Commit) d1cbc6f8 authored tarafından Zackery Spytz's avatar Zackery Spytz Kaydeden (comit) Serhiy Storchaka

Include the highest pickle protocol in a couple of tests. (GH-10735)

test_reduce_ex() in test_array.py and
test_reversevaluesiterator_pickling() in test_dict.py weren't using
the highest pickle protocol.
üst da324d53
...@@ -248,7 +248,7 @@ class BaseTest: ...@@ -248,7 +248,7 @@ class BaseTest:
a = array.array(self.typecode, self.example) a = array.array(self.typecode, self.example)
for protocol in range(3): for protocol in range(3):
self.assertIs(a.__reduce_ex__(protocol)[0], array.array) self.assertIs(a.__reduce_ex__(protocol)[0], array.array)
for protocol in range(3, pickle.HIGHEST_PROTOCOL): for protocol in range(3, pickle.HIGHEST_PROTOCOL + 1):
self.assertIs(a.__reduce_ex__(protocol)[0], array_reconstructor) self.assertIs(a.__reduce_ex__(protocol)[0], array_reconstructor)
def test_pickle(self): def test_pickle(self):
......
...@@ -1112,7 +1112,7 @@ class DictTest(unittest.TestCase): ...@@ -1112,7 +1112,7 @@ class DictTest(unittest.TestCase):
self.assertEqual(dict(it), data) self.assertEqual(dict(it), data)
def test_reversevaluesiterator_pickling(self): def test_reversevaluesiterator_pickling(self):
for proto in range(pickle.HIGHEST_PROTOCOL): for proto in range(pickle.HIGHEST_PROTOCOL + 1):
data = {1:"a", 2:"b", 3:"c"} data = {1:"a", 2:"b", 3:"c"}
# data.values() isn't picklable, only its iterator # data.values() isn't picklable, only its iterator
it = reversed(data.values()) it = reversed(data.values())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment