diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-05-11 23:42:28 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-05-11 23:42:28 (GMT) |
commit | fc3bfad2e0376ea5aa8a0c5352aafd3d731aaad7 (patch) | |
tree | e441f98008f8bcead20dddeaf5ed546fbc8d8475 /Lib/test/test_zlib.py | |
parent | 37ffc3e3ba18d0e54ea6f79e9c8aad94f0b41a7d (diff) | |
download | cpython-fc3bfad2e0376ea5aa8a0c5352aafd3d731aaad7.zip cpython-fc3bfad2e0376ea5aa8a0c5352aafd3d731aaad7.tar.gz cpython-fc3bfad2e0376ea5aa8a0c5352aafd3d731aaad7.tar.bz2 |
Issue #8681: Make the zlib module's error messages more informative when
the zlib itself doesn't give any detailed explanation.
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 2fc4313..cbc3ed4 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -135,6 +135,13 @@ class CompressTestCase(BaseCompressTestCase, unittest.TestCase): x = zlib.compress(data) self.assertEqual(zlib.decompress(x), 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) |