diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-12 09:23:04 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-12 09:23:04 (GMT) |
commit | d7a441559921804a5a6141c3ec42f896f8f3b010 (patch) | |
tree | eaeaa693fe1af5871f54222f7d07d7cc49d3dd16 /Lib/test/test_zlib.py | |
parent | a9dcdabccb1a1f7c76030c0b188ecaf7ab599e57 (diff) | |
download | cpython-d7a441559921804a5a6141c3ec42f896f8f3b010.zip cpython-d7a441559921804a5a6141c3ec42f896f8f3b010.tar.gz cpython-d7a441559921804a5a6141c3ec42f896f8f3b010.tar.bz2 |
Issue #22995: Default implementation of __reduce__ and __reduce_ex__ now
rejects builtin types with not defined __new__.
Added tests for non-pickleable types.
Diffstat (limited to 'Lib/test/test_zlib.py')
-rw-r--r-- | Lib/test/test_zlib.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py index 53bb2ad..e1575c4 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -1,6 +1,7 @@ import unittest from test import support import binascii +import pickle import random import sys from test.support import bigmemtest, _1G, _4G @@ -600,6 +601,16 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase): d.flush() self.assertRaises(ValueError, d.copy) + def test_compresspickle(self): + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + with self.assertRaises((TypeError, pickle.PicklingError)): + pickle.dumps(zlib.compressobj(zlib.Z_BEST_COMPRESSION), proto) + + def test_decompresspickle(self): + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + with self.assertRaises((TypeError, pickle.PicklingError)): + pickle.dumps(zlib.decompressobj(), proto) + # Memory use of the following functions takes into account overallocation @bigmemtest(size=_1G + 1024 * 1024, memuse=3) |