summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_zlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_zlib.py')
-rw-r--r--Lib/test/test_zlib.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index 4871d60..bf5d64c 100644
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -436,18 +436,29 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase):
# Test flush() with the various options, using all the
# different levels in order to provide more variations.
sync_opt = ['Z_NO_FLUSH', 'Z_SYNC_FLUSH', 'Z_FULL_FLUSH',
- 'Z_PARTIAL_FLUSH', 'Z_BLOCK']
+ 'Z_PARTIAL_FLUSH']
+
+ ver = tuple(int(v) for v in zlib.ZLIB_RUNTIME_VERSION.split('.'))
+ # Z_BLOCK has a known failure prior to 1.2.5.3
+ if ver >= (1, 2, 5, 3):
+ sync_opt.append('Z_BLOCK')
+
sync_opt = [getattr(zlib, opt) for opt in sync_opt
if hasattr(zlib, opt)]
data = HAMLET_SCENE * 8
for sync in sync_opt:
for level in range(10):
- obj = zlib.compressobj( level )
- a = obj.compress( data[:3000] )
- b = obj.flush( sync )
- c = obj.compress( data[3000:] )
- d = obj.flush()
+ try:
+ 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))