Skip to content

Minor test fixes for zlib and gzip #22408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/test/test_gzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def test_metadata(self):
self.assertEqual(cmByte, b'\x08') # deflate

try:
expectedname = self.filename.encode('Latin-1') + b'\x00'
expectedname = os.path.basename(self.filename).encode('Latin-1') + b'\x00'
expectedflags = b'\x08' # only the FNAME flag is set
except UnicodeEncodeError:
expectedname = b''
Expand Down
6 changes: 3 additions & 3 deletions Lib/test/test_zlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def test_decompimax(self, source=None, cx=256, dcx=64):
dco = zlib.decompressobj()
bufs = []
cb = combuf
while cb:
while not dco.eof:
#max_length = 1 + len(cb)//10
chunk = dco.decompress(cb, dcx)
self.assertFalse(len(chunk) > dcx,
Expand All @@ -439,7 +439,7 @@ def test_decompressmaxlen(self, flush=False):
dco = zlib.decompressobj()
bufs = []
cb = combuf
while cb:
while not dco.eof:
max_length = 1 + len(cb)//10
chunk = dco.decompress(cb, max_length)
self.assertFalse(len(chunk) > max_length,
Expand All @@ -449,7 +449,7 @@ def test_decompressmaxlen(self, flush=False):
if flush:
bufs.append(dco.flush())
else:
while chunk:
while not dco.eof:
chunk = dco.decompress(b'', max_length)
self.assertFalse(len(chunk) > max_length,
'chunk too big (%d>%d)' % (len(chunk),max_length))
Expand Down
Loading