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

Serhiy Storchaka webhook-mailer at python.org
Tue Nov 27 00:40:59 EST 2018


https://github.com/python/cpython/commit/d1cbc6f8a00cf881ced6238c5e652054e8fdc30f
commit: d1cbc6f8a00cf881ced6238c5e652054e8fdc30f
branch: master
author: Zackery Spytz <zspytz at gmail.com>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2018-11-27T07:40:49+02:00
summary:

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.

files:
M Lib/test/test_array.py
M Lib/test/test_dict.py

diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
index e9218f3dd68c..7f402f864471 100644
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -248,7 +248,7 @@ def test_reduce_ex(self):
         a = array.array(self.typecode, self.example)
         for protocol in range(3):
             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)
 
     def test_pickle(self):
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py
index 71fffe398f34..03afd5b2a6c7 100644
--- a/Lib/test/test_dict.py
+++ b/Lib/test/test_dict.py
@@ -1112,7 +1112,7 @@ def test_reverseitemiterator_pickling(self):
             self.assertEqual(dict(it), data)
 
     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.values() isn't picklable, only its iterator
             it = reversed(data.values())



More information about the Python-checkins mailing list