errno1.py 448 B

123456789101112131415161718192021
  1. # test errno's and uerrno module
  2. try:
  3. import uerrno
  4. except ImportError:
  5. print("SKIP")
  6. raise SystemExit
  7. # check that constants exist and are integers
  8. print(type(uerrno.EIO))
  9. # check that errors are rendered in a nice way
  10. msg = str(OSError(uerrno.EIO))
  11. print(msg[:7], msg[-5:])
  12. # check that unknown errno is still rendered
  13. print(str(OSError(9999)))
  14. # this tests a failed constant lookup in errno
  15. errno = uerrno
  16. print(errno.__name__)