https://github.com/python/cpython/commit/eecea8f64a8873c1466d4b81f4bd398b835b6cbf
commit: eecea8f64a8873c1466d4b81f4bd398b835b6cbf
branch: 3.12
author: Miss Islington (bot) <[email protected]>
committer: corona10 <[email protected]>
date: 2024-11-02T17:49:32+09:00
summary:

[3.12] gh-125522: Remove bare except in test_zlib.test_flushes (gh-126321) 
(gh-126328)

gh-125522: Remove bare except in test_zlib.test_flushes (gh-126321)
(cherry picked from commit cfb1b2f0cb999558a30e61a9e1a62fdb7f55f6a4)

Co-authored-by: simple-is-great 
<[email protected]>

files:
M Lib/test/test_zlib.py

diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index 8654b93ec64ac8..9611a0d2d02e46 100644
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -506,20 +506,16 @@ def test_flushes(self):
 
         for sync in sync_opt:
             for level in range(10):
-                try:
+                with self.subTest(sync=sync, level=level):
                     obj = zlib.compressobj( level )
                     a = obj.compress( data[:3000] )
                     b = obj.flush( sync )
                     c = obj.compress( data[3000:] )
                     d = obj.flush()
-                except:
-                    print("Error for flush mode={}, level={}"
-                          .format(sync, level))
-                    raise
-                self.assertEqual(zlib.decompress(b''.join([a,b,c,d])),
-                                 data, ("Decompress failed: flush "
-                                        "mode=%i, level=%i") % (sync, level))
-                del obj
+                    self.assertEqual(zlib.decompress(b''.join([a,b,c,d])),
+                                     data, ("Decompress failed: flush "
+                                            "mode=%i, level=%i") % (sync, 
level))
+                    del obj
 
     @unittest.skipUnless(hasattr(zlib, 'Z_SYNC_FLUSH'),
                          'requires zlib.Z_SYNC_FLUSH')

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to