diff options
Diffstat (limited to 'Lib/test/test_zlib.py')
-rw-r--r-- | Lib/test/test_zlib.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py index 0c259ccffb..4b16efb210 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -140,6 +140,13 @@ class CompressTestCase(BaseCompressTestCase, unittest.TestCase): for ob in x, bytearray(x): self.assertEqual(zlib.decompress(ob), data) + def test_incomplete_stream(self): + # An useful error message is given + x = zlib.compress(HAMLET_SCENE) + self.assertRaisesRegexp(zlib.error, + "Error -5 while decompressing data: incomplete or truncated stream", + zlib.decompress, x[:-1]) + # Memory use of the following functions takes into account overallocation @precisionbigmemtest(size=_1G + 1024 * 1024, memuse=3) |