]> granicus.if.org Git - python/commitdiff
test_bigbits was not testing what it seemed to.
authorArmin Rigo <arigo@tunes.org>
Mon, 15 Oct 2007 07:48:35 +0000 (07:48 +0000)
committerArmin Rigo <arigo@tunes.org>
Mon, 15 Oct 2007 07:48:35 +0000 (07:48 +0000)
Lib/test/test_zlib.py

index b8594de4c468f1abf604c7d3beab8c2f4b3278ec..13926e1df3621e7a24b7ee918d44ccccfba79cd3 100644 (file)
@@ -42,14 +42,18 @@ class ChecksumTestCase(unittest.TestCase):
 
 class ExceptionTestCase(unittest.TestCase):
     # make sure we generate some expected errors
-    def test_bigbits(self):
-        # specifying total bits too large causes an error
-        self.assertRaises(zlib.error,
-                zlib.compress, 'ERROR', zlib.MAX_WBITS + 1)
+    def test_badlevel(self):
+        # specifying compression level out of range causes an error
+        # (but -1 is Z_DEFAULT_COMPRESSION and apparently the zlib
+        # accepts 0 too)
+        self.assertRaises(zlib.error, zlib.compress, 'ERROR', 10)
 
     def test_badcompressobj(self):
         # verify failure on building compress object with bad params
         self.assertRaises(ValueError, zlib.compressobj, 1, zlib.DEFLATED, 0)
+        # specifying total bits too large causes an error
+        self.assertRaises(ValueError,
+                zlib.compressobj, 1, zlib.DEFLATED, zlib.MAX_WBITS + 1)
 
     def test_baddecompressobj(self):
         # verify failure on building decompress object with bad params