Skip to content

Commit af66da2

Browse files
committed
Fix test with xfl byte
1 parent 4e7c173 commit af66da2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/test_gzip_compliance.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,12 @@ def test_compresslevel_metadata(self):
408408

409409
for (name, level, expectedXflByte) in cases:
410410
major, minor, _, _, _ = sys.version_info
411-
if major == 3 and minor < 7 or major < 3:
412-
# Specific xfl bytes introduced in 3.7
411+
if not (
412+
"compresslevel" in gzip.GzipFile._write_gzip_header.__code__.co_varnames
413+
and hasattr(gzip, "_COMPRESS_LEVEL_FAST")
414+
and hasattr(gzip, "_COMPRESS_LEVEL_TRADEOFF")):
415+
# Specific xfl bytes introduced in 3.9 and backported to
416+
# earlier versions
413417
expectedXflByte = b'\x02'
414418
with self.subTest(name):
415419
fWrite = igzip.IGzipFile(self.filename, 'w',

0 commit comments

Comments
 (0)