bpo-43613: Faster implementation of gzip.compress and gzip.decompress (GH-27941)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
Ruben Vorderman 2021-09-02 17:02:59 +02:00 committed by GitHub
parent a7ef15aae8
commit ea23e7820f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 195 additions and 89 deletions

View file

@ -831,6 +831,13 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase):
dco = zlib.decompressobj(32 + 15)
self.assertEqual(dco.decompress(gzip), HAMLET_SCENE)
for wbits in (-15, 15, 31):
with self.subTest(wbits=wbits):
expected = HAMLET_SCENE
actual = zlib.decompress(
zlib.compress(HAMLET_SCENE, wbits=wbits), wbits=wbits
)
self.assertEqual(expected, actual)
def choose_lines(source, number, seed=None, generator=random):
"""Return a list of number lines randomly chosen from the source"""