diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-12 09:36:42 (GMT) |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-12 09:36:42 (GMT) |
| commit | 76e6cc15b26e58685084497c869decd2a5275b21 (patch) | |
| tree | 1afaf0317575c44ca732a449459abe05730e5522 /Lib/test/test_zlib.py | |
| parent | 10aaca9941ac6e7658de4586c8e9b28a0e9bd4b3 (diff) | |
| download | cpython-76e6cc15b26e58685084497c869decd2a5275b21.zip cpython-76e6cc15b26e58685084497c869decd2a5275b21.tar.gz cpython-76e6cc15b26e58685084497c869decd2a5275b21.tar.bz2 | |
Issue #22995: Backported additional 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 fb62081..c8fc985 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -1,6 +1,7 @@ import unittest from test.test_support import TESTFN, run_unittest, import_module, unlink, requires import binascii +import pickle import random from test.test_support import precisionbigmemtest, _1G, _4G import sys @@ -502,6 +503,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 @precisionbigmemtest(size=_1G + 1024 * 1024, memuse=3) |
