mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
More protocol 2: TUPLE1, TUPLE2, TUPLE3.
Also moved the special case for empty tuples from save() to save_tuple().
This commit is contained in:
parent
9d32bb1708
commit
44f0ea5f73
2 changed files with 47 additions and 11 deletions
|
@ -281,6 +281,18 @@ class AbstractPickleTests(unittest.TestCase):
|
|||
y = self.loads(s)
|
||||
self.assertEqual(x, y)
|
||||
|
||||
def test_short_tuples(self):
|
||||
a = ()
|
||||
b = (12,)
|
||||
c = (6, 6)
|
||||
d = (4, 4, 4)
|
||||
e = (3, 3, 3, 3)
|
||||
for proto in 0, 1, 2:
|
||||
for x in a, b, c, d, e:
|
||||
s = self.dumps(x, proto)
|
||||
y = self.loads(s)
|
||||
self.assertEqual(x, y, (proto, x, s, y))
|
||||
|
||||
class AbstractPickleModuleTests(unittest.TestCase):
|
||||
|
||||
def test_dump_closed_file(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue