Skip to content

Commit fbddb48

Browse files
committed
Add unused data test
1 parent d4cd4dc commit fbddb48

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_isal.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,16 @@ def test_decompress_igzip(data_size, level):
159159
decompressed = igzip.decompress(compressed)
160160
print(len(decompressed))
161161
assert decompressed == data
162+
163+
164+
@pytest.mark.parametrize(["unused_size", "wbits"],
165+
itertools.product(range(1,27), [-15, 15, 31]))
166+
def test_unused_data(unused_size, wbits):
167+
unused_data = b"abcdefghijklmnopqrstuvwxyz"[:unused_size]
168+
compressor = zlib.compressobj(wbits=wbits)
169+
data = b"A meaningful sentence stardts with a capital and ends with a."
170+
compressed = compressor.compress(data) + compressor.flush()
171+
decompressor = isal_zlib.decompressobj(wbits=wbits)
172+
result = decompressor.decompress(compressed + unused_data)
173+
assert result == data
174+
assert decompressor.unused_data == unused_data

0 commit comments

Comments
 (0)