summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zlib.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-05-11 23:46:02 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-05-11 23:46:02 (GMT)
commit53b2166f0ba2f63ec5711718e09f890c4fe09922 (patch)
tree98e4f2e68f73efa05b00c809f2ca8b0fc6b14271 /Lib/test/test_zlib.py
parentc09c92fd81b05db4e5bfe5322f038ca1727fcde0 (diff)
downloadcpython-53b2166f0ba2f63ec5711718e09f890c4fe09922.zip
cpython-53b2166f0ba2f63ec5711718e09f890c4fe09922.tar.gz
cpython-53b2166f0ba2f63ec5711718e09f890c4fe09922.tar.bz2
Merged revisions 81098 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r81098 | antoine.pitrou | 2010-05-12 01:42:28 +0200 (mer., 12 mai 2010) | 5 lines 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.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index 8ff2183..05adde4 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)