diff options
| author | Antoine Pitrou <solipsis@pitrou.net> | 2010-05-11 23:33:53 (GMT) |
|---|---|---|
| committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-05-11 23:33:53 (GMT) |
| commit | 33c5813a5903f1843c3066cf257f3a623a1b88ff (patch) | |
| tree | 3fe0222ab9279046534146c93c282098ef3443ea /Lib/test | |
| parent | 59170e37bb63572a84180d406fd3a155ae727a80 (diff) | |
| download | cpython-33c5813a5903f1843c3066cf257f3a623a1b88ff.zip cpython-33c5813a5903f1843c3066cf257f3a623a1b88ff.tar.gz cpython-33c5813a5903f1843c3066cf257f3a623a1b88ff.tar.bz2 | |
Merged revisions 81094 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81094 | antoine.pitrou | 2010-05-12 01:32:31 +0200 (mer., 12 mai 2010) | 6 lines
Issue #8672: Add a zlib test ensuring that an incomplete stream can be
handled by a decompressor object without errors (it returns incomplete
uncompressed data).
........
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/test_zlib.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py index 9d17c93..9137f8a 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -360,6 +360,19 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase): dco = zlib.decompressobj() self.assertEqual(dco.flush(), "") # Returns nothing + def test_decompress_incomplete_stream(self): + # This is 'foo', deflated + x = 'x\x9cK\xcb\xcf\x07\x00\x02\x82\x01E' + # For the record + self.assertEqual(zlib.decompress(x), 'foo') + self.assertRaises(zlib.error, zlib.decompress, x[:-5]) + # Omitting the stream end works with decompressor objects + # (see issue #8672). + dco = zlib.decompressobj() + y = dco.decompress(x[:-5]) + y += dco.flush() + self.assertEqual(y, 'foo') + if hasattr(zlib.compressobj(), "copy"): def test_compresscopy(self): # Test copying a compression object |
