mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
Issue #4740: Use HIGHEST_PROTOCOL in pickle test.
(There is no behavior difference in 2.x because HIGHEST_PROTOCOL == 2)
This commit is contained in:
parent
1e551b47d3
commit
0fc0747586
3 changed files with 6 additions and 6 deletions
|
@ -7,7 +7,7 @@ import unittest
|
|||
from test import test_support
|
||||
from weakref import proxy
|
||||
import array, cStringIO
|
||||
from cPickle import loads, dumps
|
||||
from cPickle import loads, dumps, HIGHEST_PROTOCOL
|
||||
|
||||
class ArraySubclass(array.array):
|
||||
pass
|
||||
|
@ -97,7 +97,7 @@ class BaseTest(unittest.TestCase):
|
|||
self.assertEqual(a, b)
|
||||
|
||||
def test_pickle(self):
|
||||
for protocol in (0, 1, 2):
|
||||
for protocol in range(HIGHEST_PROTOCOL + 1):
|
||||
a = array.array(self.typecode, self.example)
|
||||
b = loads(dumps(a, protocol))
|
||||
self.assertNotEqual(id(a), id(b))
|
||||
|
@ -112,7 +112,7 @@ class BaseTest(unittest.TestCase):
|
|||
self.assertEqual(type(a), type(b))
|
||||
|
||||
def test_pickle_for_empty_array(self):
|
||||
for protocol in (0, 1, 2):
|
||||
for protocol in range(HIGHEST_PROTOCOL + 1):
|
||||
a = array.array(self.typecode)
|
||||
b = loads(dumps(a, protocol))
|
||||
self.assertNotEqual(id(a), id(b))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue