zlib_err.py 390 B

12345678910111213141516
  1. import zlib
  2. try:
  3. zlib.compress("This should cause a TypeError because it's a str not bytes")
  4. except:
  5. print("TypeError")
  6. try:
  7. zlib.decompress("This should also cause a TypeError because it's a str not bytes")
  8. except:
  9. print("TypeError")
  10. try:
  11. zlib.decompress(b"This should cause a zlib.error because it's not valid zlib compressed data")
  12. except:
  13. print("zlib.error")