diff options
author | Brett Cannon <bcannon@gmail.com> | 2008-03-18 15:52:00 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2008-03-18 15:52:00 (GMT) |
commit | f084e048200b63273d8fea16d6146df5f6f1b058 (patch) | |
tree | 743ea0c126e59af75455139ffad1fbdeac9aeb57 /Lib/test/test_errno.py | |
parent | 10ed0f50a989f83395b7af67249d44d2419e5d3f (diff) | |
download | cpython-f084e048200b63273d8fea16d6146df5f6f1b058.zip cpython-f084e048200b63273d8fea16d6146df5f6f1b058.tar.gz cpython-f084e048200b63273d8fea16d6146df5f6f1b058.tar.bz2 |
Fix test_errno to only check for error numbers that are defined by Standard C.
Diffstat (limited to 'Lib/test/test_errno.py')
-rwxr-xr-x | Lib/test/test_errno.py | 54 |
1 files changed, 4 insertions, 50 deletions
diff --git a/Lib/test/test_errno.py b/Lib/test/test_errno.py index ca76b93..9523907 100755 --- a/Lib/test/test_errno.py +++ b/Lib/test/test_errno.py @@ -7,61 +7,15 @@ import errno from test import test_support import unittest -errors = ['E2BIG', 'EACCES', 'EADDRINUSE', 'EADDRNOTAVAIL', 'EADV', - 'EAFNOSUPPORT', 'EAGAIN', 'EALREADY', 'EBADE', 'EBADF', - 'EBADFD', 'EBADMSG', 'EBADR', 'EBADRQC', 'EBADSLT', - 'EBFONT', 'EBUSY', 'ECHILD', 'ECHRNG', 'ECOMM', - 'ECONNABORTED', 'ECONNREFUSED', 'ECONNRESET', - 'EDEADLK', 'EDEADLOCK', 'EDESTADDRREQ', 'EDOTDOT', 'EDOM', - 'EDQUOT', 'EEXIST', 'EFAULT', 'EFBIG', 'EHOSTDOWN', - 'EHOSTUNREACH', 'EIDRM', 'EILSEQ', 'EINPROGRESS', - 'EINTR', 'EINVAL', 'EIO', 'EISCONN', 'EISDIR', 'EISNAM', - 'EL2HLT', 'EL2NSYNC', 'EL3HLT', 'EL3RST', 'ELIBACC', - 'ELIBBAD', 'ELIBEXEC', 'ELIBMAX', 'ELIBSCN', 'ELNRNG', - 'ELOOP', 'EMFILE', 'EMLINK', 'EMSGSIZE', 'EMULTIHOP', - 'ENAMETOOLONG', 'ENAVAIL', 'ENETDOWN', 'ENETRESET', 'ENETUNREACH', - 'ENFILE', 'ENOANO', 'ENOBUFS', 'ENOCSI', 'ENODATA', - 'ENODEV', 'ENOENT', 'ENOEXEC', 'ENOLCK', 'ENOLINK', - 'ENOMEM', 'ENOMSG', 'ENONET', 'ENOPKG', 'ENOPROTOOPT', - 'ENOSPC', 'ENOSR', 'ENOSTR', 'ENOSYS', 'ENOTBLK', - 'ENOTCONN', 'ENOTDIR', 'ENOTEMPTY', 'ENOTNAM', 'ENOTOBACCO', 'ENOTSOCK', - 'ENOTTY', 'ENOTUNIQ', 'ENXIO', 'EOPNOTSUPP', - 'EOVERFLOW', 'EPERM', 'EPFNOSUPPORT', 'EPIPE', - 'EPROTO', 'EPROTONOSUPPORT', 'EPROTOTYPE', - 'ERANGE', 'EREMCHG', 'EREMOTE', 'EREMOTEIO', 'ERESTART', - 'EROFS', 'ESHUTDOWN', 'ESOCKTNOSUPPORT', 'ESPIPE', - 'ESRCH', 'ESRMNT', 'ESTALE', 'ESTRPIPE', 'ETIME', - 'ETIMEDOUT', 'ETOOMANYREFS', 'ETXTBSY', 'EUCLEAN', 'EUNATCH', - 'EUSERS', 'EWOULDBLOCK', 'EXDEV', 'EXFULL', - 'WSABASEERR', 'WSADESCRIPTIO', 'WSAEACCES', 'WSAEADDRINUSE', - 'WSAEADDRNOTAVAIL', 'WSAEAFNOSUPPORT', 'WSAEALREADY', - 'WSAEBADF', 'WSAECONNABORTED', 'WSAECONNREFUSED', - 'WSAECONNRESET', 'WSAEDESTADDRREQ', 'WSAEDISCON', - 'WSAEDQUOT', 'WSAEFAULT', 'WSAEHOSTDOWN', 'WSAEHOSTUNREACH', - 'WSAEINPROGRESS', 'WSAEINTR', 'WSAEINVAL', 'WSAEISCONN', - 'WSAELOOP', 'WSAEMFILE', 'WSAEMSGSIZE', 'WSAENAMETOOLONG', - 'WSAENETDOWN', 'WSAENETRESET', 'WSAENETUNREACH', - 'WSAENOBUFS', 'WSAENOPROTOOPT', 'WSAENOTCONN', - 'WSAENOTEMPTY', 'WSAENOTSOCK', 'WSAEOPNOTSUPP', - 'WSAEPFNOSUPPORT', 'WSAEPROCLIM', 'WSAEPROTONOSUPPORT', - 'WSAEPROTOTYPE', 'WSAEREMOTE', 'WSAESHUTDOWN', - 'WSAESOCKTNOSUPPORT', 'WSAESTALE', 'WSAETIMEDOUT', - 'WSAETOOMANYREFS', 'WSAEUSERS', 'WSAEWOULDBLOCK', - 'WSAGETASYNCBUFLE', 'WSAGETASYNCERRO', 'WSAGETSELECTERRO', - 'WSAGETSELECTEVEN', 'WSAHOS', 'WSAMAKEASYNCREPL', - 'WSAMAKESELECTREPL', 'WSAN', 'WSANOTINITIALISED', 'WSASY', - 'WSASYSNOTREADY', 'WSATR', 'WSAVERNOTSUPPORTED'] - +std_c_errors = frozenset(['EDOM', 'ERANGE']) class ErrnoAttributeTests(unittest.TestCase): def test_for_improper_attributes(self): # No unexpected attributes should be on the module. - errors_set = set(errors) - for attribute in errno.__dict__.iterkeys(): - if attribute.isupper(): - self.assert_(attribute in errors_set, - "%s is an unexpected error value" % attribute) + for error_code in std_c_errors: + self.assert_(hasattr(errno, error_code), + "errno is missing %s" % error_code) def test_using_errorcode(self): # Every key value in errno.errorcode should be on the module. |