Commit aaef3448 authored by Ezio Melotti's avatar Ezio Melotti

#17346: make sure pickle tests are run against all protocols. Initial patch by Marius Gedminas.

parent 7b39b9b5
...@@ -577,10 +577,10 @@ class AbstractPickleTests(unittest.TestCase): ...@@ -577,10 +577,10 @@ class AbstractPickleTests(unittest.TestCase):
i = C() i = C()
i.attr = i i.attr = i
for proto in protocols: for proto in protocols:
s = self.dumps(i, 2) s = self.dumps(i, proto)
x = self.loads(s) x = self.loads(s)
self.assertEqual(dir(x), dir(i)) self.assertEqual(dir(x), dir(i))
self.assertTrue(x.attr is x) self.assertIs(x.attr, x)
def test_recursive_multi(self): def test_recursive_multi(self):
l = [] l = []
...@@ -637,13 +637,13 @@ class AbstractPickleTests(unittest.TestCase): ...@@ -637,13 +637,13 @@ class AbstractPickleTests(unittest.TestCase):
def test_bytes(self): def test_bytes(self):
for proto in protocols: for proto in protocols:
for s in b'', b'xyz', b'xyz'*100: for s in b'', b'xyz', b'xyz'*100:
p = self.dumps(s) p = self.dumps(s, proto)
self.assertEqual(self.loads(p), s) self.assertEqual(self.loads(p), s)
for s in [bytes([i]) for i in range(256)]: for s in [bytes([i]) for i in range(256)]:
p = self.dumps(s) p = self.dumps(s, proto)
self.assertEqual(self.loads(p), s) self.assertEqual(self.loads(p), s)
for s in [bytes([i, i]) for i in range(256)]: for s in [bytes([i, i]) for i in range(256)]:
p = self.dumps(s) p = self.dumps(s, proto)
self.assertEqual(self.loads(p), s) self.assertEqual(self.loads(p), s)
def test_ints(self): def test_ints(self):
......
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