summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-06-05 10:48:34 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-06-05 10:48:34 (GMT)
commit3f0ee83f14f2ce2c05360f5ed326844388353b6f (patch)
tree7a222185d5377d9b6e3e423c29a849fad47859a3 /Lib
parent484c913ed9fc438cedd2757d6124ab1bac4239be (diff)
downloadcpython-3f0ee83f14f2ce2c05360f5ed326844388353b6f.zip
cpython-3f0ee83f14f2ce2c05360f5ed326844388353b6f.tar.gz
cpython-3f0ee83f14f2ce2c05360f5ed326844388353b6f.tar.bz2
Issue #27164: Allow decompressing raw Deflate streams with predefined zdict
Based on patch by Xiang Zhang.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_zlib.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index b6bebbc..78ecade 100644
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -553,6 +553,15 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase):
self.assertEqual(dco.unconsumed_tail, b'')
self.assertEqual(dco.unused_data, remainder)
+ # issue27164
+ def test_decompress_raw_with_dictionary(self):
+ zdict = b'abcdefghijklmnopqrstuvwxyz'
+ co = zlib.compressobj(wbits=-zlib.MAX_WBITS, zdict=zdict)
+ comp = co.compress(zdict) + co.flush()
+ dco = zlib.decompressobj(wbits=-zlib.MAX_WBITS, zdict=zdict)
+ uncomp = dco.decompress(comp) + dco.flush()
+ self.assertEqual(zdict, uncomp)
+
def test_flush_with_freed_input(self):
# Issue #16411: decompressor accesses input to last decompress() call
# in flush(), even if this object has been freed in the meanwhile.