Skip to content

Commit a6fc90f

Browse files
committed
tests/uzlib_decompress: Actually test raw DEFLATE stream.
1 parent ed4ce19 commit a6fc90f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/extmod/uzlib_decompress.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,17 @@
1818

1919

2020
# Raw DEFLATE bitstream
21-
v = b'\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x05\x00\x00\x00'
21+
v = b'\xcbH\xcd\xc9\xc9\x07\x00'
2222
exp = b"hello"
2323
out = zlib.decompress(v, -15)
2424
assert(out == exp)
2525
print(exp)
26+
# Even when you ask CPython zlib.compress to produce Raw DEFLATE stream,
27+
# it returns it with adler2 and oriignal size appended, as if it was a
28+
# zlib stream. Make sure there're no random issues decompressing such.
29+
v = b'\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x05\x00\x00\x00'
30+
out = zlib.decompress(v, -15)
31+
assert(out == exp)
2632

2733
# this should error
2834
try:

0 commit comments

Comments
 (0)