Skip to content

Commit 8a57cac

Browse files
flowergrassdpgeorge
authored andcommitted
tests/extmod: Improve tinfgzip.c test coverage.
1 parent a49a96b commit 8a57cac

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

tests/extmod/uzlib_decompio_gz.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@
2020
print(inp.read())
2121
print(buf.seek(0, 1))
2222

23+
# Check FHCRC field
24+
buf = io.BytesIO(b'\x1f\x8b\x08\x02\x99\x0c\xe5W\x00\x03\x00\x00\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x05\x00\x00\x00')
25+
inp = zlib.DecompIO(buf, 16 + 8)
26+
print(inp.read())
27+
28+
# Check FEXTRA field
29+
buf = io.BytesIO(b'\x1f\x8b\x08\x04\x99\x0c\xe5W\x00\x03\x01\x00X\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x05\x00\x00\x00')
30+
inp = zlib.DecompIO(buf, 16 + 8)
31+
print(inp.read())
32+
2333
# broken header
2434
buf = io.BytesIO(b'\x1f\x8c\x08\x08\x99\x0c\xe5W\x00\x03hello\x00\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x05\x00\x00\x00')
2535
try:

tests/extmod/uzlib_decompio_gz.py.exp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ b'lo'
77
b''
88
b''
99
31
10+
b'hello'
11+
b'hello'
1012
ValueError
1113
OSError(22,)

0 commit comments

Comments
 (0)