diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-09-04 14:45:27 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-09-04 14:45:27 +0300 |
commit | 61e2dfd97dde31c6f6f1005aa0c0a1f616963f7a (patch) | |
tree | fb57a43ebba8433a7f7d72bf7d8ee345280c88d0 /tests/extmod/uzlib_decompio.py | |
parent | 1bc5cb4312cae9702ab5fe5412b16156a08b8280 (diff) | |
download | micropython-61e2dfd97dde31c6f6f1005aa0c0a1f616963f7a.tar.gz micropython-61e2dfd97dde31c6f6f1005aa0c0a1f616963f7a.zip |
tests/extmod/uzlib_decompio: Add zlib bitstream testcases.
Diffstat (limited to 'tests/extmod/uzlib_decompio.py')
-rw-r--r-- | tests/extmod/uzlib_decompio.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/extmod/uzlib_decompio.py b/tests/extmod/uzlib_decompio.py index ee3204d07c..75a6df0ca4 100644 --- a/tests/extmod/uzlib_decompio.py +++ b/tests/extmod/uzlib_decompio.py @@ -7,7 +7,7 @@ import uio as io # Raw DEFLATE bitstream buf = io.BytesIO(b'\xcbH\xcd\xc9\xc9\x07\x00') -inp = zlib.DecompIO(buf) +inp = zlib.DecompIO(buf, -8) print(buf.seek(0, 1)) print(inp.read(1)) print(buf.seek(0, 1)) @@ -17,3 +17,16 @@ print(buf.seek(0, 1)) print(inp.read(1)) print(inp.read()) print(buf.seek(0, 1)) + + +# zlib bitstream +inp = zlib.DecompIO(io.BytesIO(b'x\x9c30\xa0=\x00\x00\xb3q\x12\xc1')) +print(inp.read(10)) +print(inp.read()) + +# zlib bitstream, wrong checksum +inp = zlib.DecompIO(io.BytesIO(b'x\x9c30\xa0=\x00\x00\xb3q\x12\xc0')) +try: + print(inp.read()) +except OSError as e: + print(repr(e)) |