8000 [3.13] gh-125522: Remove bare except in test_zlib.test_flushes (gh-126321) by miss-islington · Pull Request #126327 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.13] gh-125522: Remove bare except in test_zlib.test_flushes (gh-126321) #126327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
  • Loading branch information
simple-is-great authored and miss-islington committed Nov 2, 2024
commit 46db2ceb05af2ac4f2597b1da1e5bf84d86fc5bc
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
Loading
0