diff Lib/test/test_zlib.py @ 61524:4b10ef8a024c 3.1

Merged revisions 81100 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r81100 | antoine.pitrou | 2010-05-12 01:46:02 +0200 (mer., 12 mai 2010) | 10 lines 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. ........ ................
author Antoine Pitrou <solipsis@pitrou.net>
date Tue, 11 May 2010 23:49:58 +0000
parents ef4de053d577
children f8a77fd675f5
line wrap: on
line diff
--- a/Lib/test/test_zlib.py	Tue May 11 23:38:15 2010 +0000
+++ b/Lib/test/test_zlib.py	Tue May 11 23:49:58 2010 +0000
@@ -140,6 +140,13 @@
         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)