diff options
author | Gregory P. Smith <greg@krypto.org> | 2017-01-22 17:29:44 -0800 |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2017-01-22 17:29:44 -0800 |
commit | d71a238820a6e746c7bb1995d8f236b40904924d (patch) | |
tree | 1da08aa6698b4a9dcaa5e90d9541b78ac11e1650 /Lib/test/test_zlib.py | |
parent | d49be132fb4eb2d302592ebd84fafc4a1c98e531 (diff) | |
parent | 424881df2c661ba4238f9f56f273a5f4974f74d4 (diff) | |
download | cpython-d71a238820a6e746c7bb1995d8f236b40904924d.tar.gz |
Issue #29335: Fix subprocess.Popen.wait() when the child process has
exited to a stopped instead of terminated state (ex: when under ptrace).
Diffstat (limited to 'Lib/test/test_zlib.py')
-rw-r--r-- | Lib/test/test_zlib.py | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py index 6fea893993..20174d8343 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -164,6 +164,16 @@ class CompressTestCase(BaseCompressTestCase, unittest.TestCase): x = zlib.compress(HAMLET_SCENE) self.assertEqual(zlib.decompress(x), HAMLET_SCENE) + def test_keywords(self): + x = zlib.compress(HAMLET_SCENE, level=3) + self.assertEqual(zlib.decompress(x), HAMLET_SCENE) + with self.assertRaises(TypeError): + zlib.compress(data=HAMLET_SCENE, level=3) + self.assertEqual(zlib.decompress(x, + wbits=zlib.MAX_WBITS, + bufsize=zlib.DEF_BUF_SIZE), + HAMLET_SCENE) + def test_speech128(self): # compress more data data = HAMLET_SCENE * 128 @@ -234,6 +244,27 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase): self.assertIsInstance(dco.unconsumed_tail, bytes) self.assertIsInstance(dco.unused_data, bytes) + def test_keywords(self): + level = 2 + method = zlib.DEFLATED + wbits = -12 + memLevel = 9 + strategy = zlib.Z_FILTERED + co = zlib.compressobj(level=level, + method=method, + wbits=wbits, + memLevel=memLevel, + strategy=strategy, + zdict=b"") + do = zlib.decompressobj(wbits=wbits, zdict=b"") + with self.assertRaises(TypeError): + co.compress(data=HAMLET_SCENE) + with self.assertRaises(TypeError): + do.decompress(data=zlib.compress(HAMLET_SCENE)) + x = co.compress(HAMLET_SCENE) + co.flush() + y = do.decompress(x, max_length=len(HAMLET_SCENE)) + do.flush() + self.assertEqual(HAMLET_SCENE, y) + def test_compressoptions(self): # specify lots of options to compressobj() level = 2 @@ -249,10 +280,6 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase): y2 = dco.flush() self.assertEqual(HAMLET_SCENE, y1 + y2) - # keyword arguments should also be supported - zlib.compressobj(level=level, method=method, wbits=wbits, - memLevel=memLevel, strategy=strategy, zdict=b"") - def test_compressincremental(self): # compress object in steps, decompress object as one-shot data = HAMLET_SCENE * 128 |