From a6fc90f92ac0f2275c59cba131f99e541139c3cf Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Wed, 17 Aug 2016 06:10:16 +0300 Subject: [PATCH] tests/uzlib_decompress: Actually test raw DEFLATE stream. --- tests/extmod/uzlib_decompress.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/extmod/uzlib_decompress.py b/tests/extmod/uzlib_decompress.py index 4a898f27c7..468335a0d1 100644 --- a/tests/extmod/uzlib_decompress.py +++ b/tests/extmod/uzlib_decompress.py @@ -18,11 +18,17 @@ for unpacked, packed in PATTERNS: # Raw DEFLATE bitstream -v = b'\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x05\x00\x00\x00' +v = b'\xcbH\xcd\xc9\xc9\x07\x00' exp = b"hello" out = zlib.decompress(v, -15) assert(out == exp) print(exp) +# Even when you ask CPython zlib.compress to produce Raw DEFLATE stream, +# it returns it with adler2 and oriignal size appended, as if it was a +# zlib stream. Make sure there're no random issues decompressing such. +v = b'\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x05\x00\x00\x00' +out = zlib.decompress(v, -15) +assert(out == exp) # this should error try: