pikapython/examples/zlib/zlib_err.py
2023-07-06 02:39:57 +08:00

17 lines
390 B
Python

import zlib
try:
zlib.compress("This should cause a TypeError because it's a str not bytes")
except:
print("TypeError")
try:
zlib.decompress("This should also cause a TypeError because it's a str not bytes")
except:
print("TypeError")
try:
zlib.decompress(b"This should cause a zlib.error because it's not valid zlib compressed data")
except:
print("zlib.error")