diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2011-12-13 18:08:09 (GMT) |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2011-12-13 18:08:09 (GMT) |
commit | 3bfc65a25ba2e010ef12db0cff006c2cbbeb18f9 (patch) | |
tree | 48d1cd0accf5405ab51196dee2f68551fd9e9175 /Lib/test | |
parent | 7b7e39a61f0c784252f94eeaae8ee44a44968a6f (diff) | |
download | cpython-3bfc65a25ba2e010ef12db0cff006c2cbbeb18f9.zip cpython-3bfc65a25ba2e010ef12db0cff006c2cbbeb18f9.tar.gz cpython-3bfc65a25ba2e010ef12db0cff006c2cbbeb18f9.tar.bz2 |
Issue #13505: Make pickling of bytes object compatible with Python 2.
Initial patch by sbt.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/pickletester.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py index 49be720..cab0523 100644 --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -636,9 +636,15 @@ class AbstractPickleTests(unittest.TestCase): def test_bytes(self): for proto in protocols: - for u in b'', b'xyz', b'xyz'*100: - p = self.dumps(u) - self.assertEqual(self.loads(p), u) + for s in b'', b'xyz', b'xyz'*100: + p = self.dumps(s) + self.assertEqual(self.loads(p), s) + for s in [bytes([i]) for i in range(256)]: + p = self.dumps(s) + self.assertEqual(self.loads(p), s) + for s in [bytes([i, i]) for i in range(256)]: + p = self.dumps(s) + self.assertEqual(self.loads(p), s) def test_ints(self): import sys |