mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
[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 cfb1b2f0cb
)
Co-authored-by: simple-is-great <103080930+simple-is-great@users.noreply.github.com>
This commit is contained in:
parent
f58d5ab881
commit
79ec946c16
1 changed files with 5 additions and 9 deletions
|
@ -505,20 +505,16 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase):
|
|||
|
||||
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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue