Skip to content

Commit

Permalink
[3.13] pythongh-125522: Remove bare except in test_zlib.test_flushes (p…
Browse files Browse the repository at this point in the history
…ythongh-126321) (pythongh-126327)

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

Co-authored-by: simple-is-great <[email protected]>
  • Loading branch information
miss-islington and simple-is-great authored Nov 2, 2024
1 parent f58d5ab commit 79ec946
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions Lib/test/test_zlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,20 +505,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')
Expand Down

0 comments on commit 79ec946

Please sign in to comment.