Skip to content

Fix the raw deflate unused_data tests when test_offset is 0 - #293

Open
ptweezy wants to merge 1 commit into
pycompression:developfrom
ptweezy:test-raw-deflate-offset
Open

ptweezy wants to merge 1 commit into
pycompression:developfrom
ptweezy:test-raw-deflate-offset

Conversation

@ptweezy

@ptweezy ptweezy commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

test_igzip_decompressor_raw_deflate_unused_data_zlib and test_igzip_decompressor_raw_deflate_unused_data_gzip cut test_offset bytes off the trailer with no_header[:-test_offset]. When test_offset is 0, that slice is empty, so the decompressor never reaches the end of the stream, and if igzd.eof: skips the assertion. That check would also hide a bug that stops eof from being set.

The tests now slice up to len(no_header) - test_offset and assert igzd.eof. All 14 cases pass, including the two with test_offset 0, which asserted nothing before.

This PR changes only tests, so it has no CHANGELOG entry.

Checklist

  • Pull request details were added to CHANGELOG.rst
  • Documentation was updated (if needed)

no_header[:-test_offset] is empty when test_offset is 0, so the
decompressor never reaches the end of the stream and the eof check
skips the assertion. Slice up to len(no_header) - test_offset and
assert eof.
@ptweezy
ptweezy force-pushed the test-raw-deflate-offset branch from a8b9fc6 to dcad7cf Compare October 24, 2026 17:05

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant