8000 [3.13] gh-125522: Remove bare except in test_zlib.test_flushes (gh-12… · python/cpython@79ec946 · GitHub
[go: up one dir, main page]

Skip to content

Commit 79ec946

Browse files
[3.13] gh-125522: Remove bare except in test_zlib.test_flushes (gh-126321) (gh-126327)
gh-125522: Remove bare except in test_zlib.test_flushes (gh-126321) (cherry picked from commit cfb1b2f) Co-authored-by: simple-is-great <103080930+simple-is-great@users.noreply.github.com>
1 parent f58d5ab commit 79ec946

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

Lib/test/test_zlib.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -505,20 +505,16 @@ def test_flushes(self):
505505

506506
for sync in sync_opt:
507507
for level in range(10):
508-
try:
508+
with self.subTest(sync=sync, level=level):
509509
obj = zlib.compressobj( level )
510510
a = obj.compress( data[:3000] )
511511
b = obj.flush( sync )
512512
c = obj.compress( data[3000:] )
513513
d = obj.flush()
514-
except:
515-
print("Error for flush mode={}, level={}"
516-
.format(sync, level))
517-
raise
518-
self.assertEqual(zlib.decompress(b''.join([a,b,c,d])),
519-
data, ("Decompress failed: flush "
520-
"mode=%i, level=%i") % (sync, level))
521-
del obj
514+
self.assertEqual(zlib.decompress(b''.join([a,b,c,d])),
515+
data, ("Decompress failed: flush "
516+
"mode=%i, level=%i") % (sync, level))
517+
del obj
522518

523519
@unittest.skipUnless(hasattr(zlib, 'Z_SYNC_FLUSH'),
524520
'requires zlib.Z_SYNC_FLUSH')

0 commit comments

Comments
 (0)
0