diff options
author | pmp-p <pmp-p@users.noreply.github.com> | 2018-02-19 03:45:11 (GMT) |
---|---|---|
committer | Zachary Ware <zachary.ware@gmail.com> | 2018-02-19 03:45:11 (GMT) |
commit | 4c7108a77144493d0aa6fc0105b67d3797e143f5 (patch) | |
tree | 77b9c64b35a88b86387588e6d2d1a106da869032 | |
parent | dfa015cf77a148d229ddc0a5b063562c9f9664f2 (diff) | |
download | cpython-4c7108a77144493d0aa6fc0105b67d3797e143f5.zip cpython-4c7108a77144493d0aa6fc0105b67d3797e143f5.tar.gz cpython-4c7108a77144493d0aa6fc0105b67d3797e143f5.tar.bz2 |
bpo-32682: Improve libz version parsing in test_zilb (GH-5347)
-rw-r--r-- | Lib/test/test_zlib.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py index e67bee9..db950fc 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -751,10 +751,15 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase): def test_wbits(self): # wbits=0 only supported since zlib v1.2.3.5 # Register "1.2.3" as "1.2.3.0" - v = (zlib.ZLIB_RUNTIME_VERSION + ".0").split(".", 4) - supports_wbits_0 = int(v[0]) > 1 or int(v[0]) == 1 \ - and (int(v[1]) > 2 or int(v[1]) == 2 - and (int(v[2]) > 3 or int(v[2]) == 3 and int(v[3]) >= 5)) + # or "1.2.0-linux","1.2.0.f","1.2.0.f-linux" + v = zlib.ZLIB_RUNTIME_VERSION.split('-', 1)[0].split('.') + if len(v) < 4: + v.append('0') + elif not v[-1].isnumeric(): + v[-1] = '0' + + v = tuple(map(int, v)) + supports_wbits_0 = v >= (1, 2, 3, 5) co = zlib.compressobj(level=1, wbits=15) zlib15 = co.compress(HAMLET_SCENE) + co.flush() |