aboutsummaryrefslogtreecommitdiff
path: root/tests/extmod/uzlib_decompio_gz.py
diff options
context:
space:
mode:
authorDavid Lechner2020-03-22 21:26:08 -0500
committerDamien George2020-03-30 13:21:58 +1100
commit3dc324d3f1312e40d3a8ed87e7244966bb756f26 (patch)
tree94ff44f8eabba0039582c245b901173597edd11e /tests/extmod/uzlib_decompio_gz.py
parent488613bca6c460340ed2995ae5cafafe22d0bfff (diff)
tests: Format all Python code with black, except tests in basics subdir.
This adds the Python files in the tests/ directory to be formatted with ./tools/codeformat.py. The basics/ subdirectory is excluded for now so we aren't changing too much at once. In a few places `# fmt: off`/`# fmt: on` was used where the code had special formatting for readability or where the test was actually testing the specific formatting.
Diffstat (limited to 'tests/extmod/uzlib_decompio_gz.py')
-rw-r--r--tests/extmod/uzlib_decompio_gz.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/tests/extmod/uzlib_decompio_gz.py b/tests/extmod/uzlib_decompio_gz.py
index 02087f763..1bc8ba885 100644
--- a/tests/extmod/uzlib_decompio_gz.py
+++ b/tests/extmod/uzlib_decompio_gz.py
@@ -7,7 +7,9 @@ except ImportError:
# gzip bitstream
-buf = io.BytesIO(b'\x1f\x8b\x08\x08\x99\x0c\xe5W\x00\x03hello\x00\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x05\x00\x00\x00')
+buf = io.BytesIO(
+ b"\x1f\x8b\x08\x08\x99\x0c\xe5W\x00\x03hello\x00\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x05\x00\x00\x00"
+)
inp = zlib.DecompIO(buf, 16 + 8)
print(buf.seek(0, 1))
print(inp.read(1))
@@ -20,24 +22,32 @@ print(inp.read())
print(buf.seek(0, 1))
# Check FHCRC field
-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')
+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"
+)
inp = zlib.DecompIO(buf, 16 + 8)
print(inp.read())
# Check FEXTRA field
-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')
+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"
+)
inp = zlib.DecompIO(buf, 16 + 8)
print(inp.read())
# broken header
-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')
+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"
+)
try:
inp = zlib.DecompIO(buf, 16 + 8)
except ValueError:
print("ValueError")
# broken crc32
-buf = io.BytesIO(b'\x1f\x8b\x08\x08\x99\x0c\xe5W\x00\x03hello\x00\xcbH\xcd\xc9\xc9\x07\x00\x86\xa7\x106\x05\x00\x00\x00')
+buf = io.BytesIO(
+ b"\x1f\x8b\x08\x08\x99\x0c\xe5W\x00\x03hello\x00\xcbH\xcd\xc9\xc9\x07\x00\x86\xa7\x106\x05\x00\x00\x00"
+)
inp = zlib.DecompIO(buf, 16 + 8)
try:
inp.read(6)
@@ -45,6 +55,6 @@ except OSError as e:
print(repr(e))
# broken uncompressed size - not checked so far
-#buf = io.BytesIO(b'\x1f\x8b\x08\x08\x99\x0c\xe5W\x00\x03hello\x00\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x06\x00\x00\x00')
-#inp = zlib.DecompIO(buf, 16 + 8)
-#inp.read(6)
+# buf = io.BytesIO(b'\x1f\x8b\x08\x08\x99\x0c\xe5W\x00\x03hello\x00\xcbH\xcd\xc9\xc9\x07\x00\x86\xa6\x106\x06\x00\x00\x00')
+# inp = zlib.DecompIO(buf, 16 + 8)
+# inp.read(6)