# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.

# tests for module 'errno'

import errno
import unittest

from iptest import IronPythonTestCase, is_windows, is_linux, is_osx, run_test

class ErrnoTest(IronPythonTestCase):
    def compare_codes(self, expected):
        self.assertEqual(frozenset(errno.errorcode.values()), frozenset(expected.values()))
        self.assertEqual(frozenset(errno.errorcode.keys()), frozenset(expected.keys()))
        for code in errno.errorcode:
            self.assertEqual(errno.errorcode[code], expected[code])

    def compare_values(self, expected):
        for symbol in expected:
            self.assertEqual(getattr(errno, symbol), expected[symbol])

    @unittest.skipUnless(is_windows, "Windows specific test")
    def test_errno_codes_windows(self):
        # CPython 3.10 on Windows 11

        # python3 -c 'import errno;print(errno.errorcode)'
        cpython_errorcode = {19: 'ENODEV', 10065: 'WSAEHOSTUNREACH', 122: 'ENOMSG', 120: 'ENODATA', 40: 'ENOSYS', 32: 'EPIPE', 22: 'EINVAL', 132: 'EOVERFLOW', 4: 'EINTR', 10068: 'WSAEUSERS', 41: 'ENOTEMPTY', 10055: 'WSAENOBUFS', 134: 'EPROTO', 10071: 'WSAEREMOTE', 10: 'ECHILD', 10062: 'WSAELOOP', 18: 'EXDEV', 7: 'E2BIG', 3: 'ESRCH', 10040: 'WSAEMSGSIZE', 10047: 'WSAEAFNOSUPPORT', 10064: 'WSAEHOSTDOWN', 10046: 'WSAEPFNOSUPPORT', 10042: 'WSAENOPROTOOPT', 16: 'EBUSY', 10035: 'WSAEWOULDBLOCK', 10056: 'WSAEISCONN', 10058: 'WSAESHUTDOWN', 9: 'EBADF', 5: 'EIO', 10041: 'WSAEPROTOTYPE', 28: 'ENOSPC', 8: 'ENOEXEC', 10037: 'WSAEALREADY', 10050: 'WSAENETDOWN', 13: 'EACCES', 42: 'EILSEQ', 20: 'ENOTDIR', 1: 'EPERM', 33: 'EDOM', 10061: 'WSAECONNREFUSED', 21: 'EISDIR', 10043: 'WSAEPROTONOSUPPORT', 30: 'EROFS', 10049: 'WSAEADDRNOTAVAIL', 111: 'EIDRM', 104: 'EBADMSG', 23: 'ENFILE', 29: 'ESPIPE', 121: 'ENOLINK', 10052: 'WSAENETRESET', 10060: 'WSAETIMEDOUT', 2: 'ENOENT', 17: 'EEXIST', 10069: 'WSAEDQUOT', 125: 'ENOSTR', 14: 'EFAULT', 27: 'EFBIG', 36: 'EDEADLOCK', 10057: 'WSAENOTCONN', 10039: 'WSAEDESTADDRREQ', 39: 'ENOLCK', 10053: 'WSAECONNABORTED', 10051: 'WSAENETUNREACH', 10070: 'WSAESTALE', 124: 'ENOSR', 12: 'ENOMEM', 10038: 'WSAENOTSOCK', 31: 'EMLINK', 34: 'ERANGE', 10054: 'WSAECONNRESET', 10048: 'WSAEADDRINUSE', 10045: 'WSAEOPNOTSUPP', 11: 'EAGAIN', 38: 'ENAMETOOLONG', 25: 'ENOTTY', 10044: 'WSAESOCKTNOSUPPORT', 137: 'ETIME', 10059: 'WSAETOOMANYREFS', 24: 'EMFILE', 139: 'ETXTBSY', 10036: 'WSAEINPROGRESS', 6: 'ENXIO', 10024: 'WSAEMFILE', 10092: 'WSAVERNOTSUPPORTED', 10067: 'WSAEPROCLIM', 10014: 'WSAEFAULT', 10093: 'WSANOTINITIALISED', 10063: 'WSAENAMETOOLONG', 10066: 'WSAENOTEMPTY', 10013: 'WSAEACCES', 10000: 'WSABASEERR', 10009: 'WSAEBADF', 10101: 'WSAEDISCON', 10004: 'WSAEINTR', 10091: 'WSASYSNOTREADY', 10022: 'WSAEINVAL', 105: 'ECANCELED', 133: 'EOWNERDEAD', 127: 'ENOTRECOVERABLE', 129: 'ENOTSUP'}
        self.compare_codes(cpython_errorcode)

        # python3 -c 'import errno;print({s:getattr(errno, s) for s in dir(errno) if s.isupper()})'
        cpython_errorval = {'E2BIG': 7, 'EACCES': 13, 'EADDRINUSE': 10048, 'EADDRNOTAVAIL': 10049, 'EAFNOSUPPORT': 10047, 'EAGAIN': 11, 'EALREADY': 10037, 'EBADF': 9, 'EBADMSG': 104, 'EBUSY': 16, 'ECANCELED': 105, 'ECHILD': 10, 'ECONNABORTED': 10053, 'ECONNREFUSED': 10061, 'ECONNRESET': 10054, 'EDEADLK': 36, 'EDEADLOCK': 36, 'EDESTADDRREQ': 10039, 'EDOM': 33, 'EDQUOT': 10069, 'EEXIST': 17, 'EFAULT': 14, 'EFBIG': 27, 'EHOSTDOWN': 10064, 'EHOSTUNREACH': 10065, 'EIDRM': 111, 'EILSEQ': 42, 'EINPROGRESS': 10036, 'EINTR': 4, 'EINVAL': 22, 'EIO': 5, 'EISCONN': 10056, 'EISDIR': 21, 'ELOOP': 10062, 'EMFILE': 24, 'EMLINK': 31, 'EMSGSIZE': 10040, 'ENAMETOOLONG': 38, 'ENETDOWN': 10050, 'ENETRESET': 10052, 'ENETUNREACH': 10051, 'ENFILE': 23, 'ENOBUFS': 10055, 'ENODATA': 120, 'ENODEV': 19, 'ENOENT': 2, 'ENOEXEC': 8, 'ENOLCK': 39, 'ENOLINK': 121, 'ENOMEM': 12, 'ENOMSG': 122, 'ENOPROTOOPT': 10042, 'ENOSPC': 28, 'ENOSR': 124, 'ENOSTR': 125, 'ENOSYS': 40, 'ENOTCONN': 10057, 'ENOTDIR': 20, 'ENOTEMPTY': 41, 'ENOTRECOVERABLE': 127, 'ENOTSOCK': 10038, 'ENOTSUP': 129, 'ENOTTY': 25, 'ENXIO': 6, 'EOPNOTSUPP': 10045, 'EOVERFLOW': 132, 'EOWNERDEAD': 133, 'EPERM': 1, 'EPFNOSUPPORT': 10046, 'EPIPE': 32, 'EPROTO': 134, 'EPROTONOSUPPORT': 10043, 'EPROTOTYPE': 10041, 'ERANGE': 34, 'EREMOTE': 10071, 'EROFS': 30, 'ESHUTDOWN': 10058, 'ESOCKTNOSUPPORT': 10044, 'ESPIPE': 29, 'ESRCH': 3, 'ESTALE': 10070, 'ETIME': 137, 'ETIMEDOUT': 10060, 'ETOOMANYREFS': 10059, 'ETXTBSY': 139, 'EUSERS': 10068, 'EWOULDBLOCK': 10035, 'EXDEV': 18, 'WSABASEERR': 10000, 'WSAEACCES': 10013, 'WSAEADDRINUSE': 10048, 'WSAEADDRNOTAVAIL': 10049, 'WSAEAFNOSUPPORT': 10047, 'WSAEALREADY': 10037, 'WSAEBADF': 10009, 'WSAECONNABORTED': 10053, 'WSAECONNREFUSED': 10061, 'WSAECONNRESET': 10054, 'WSAEDESTADDRREQ': 10039, 'WSAEDISCON': 10101, 'WSAEDQUOT': 10069, 'WSAEFAULT': 10014, 'WSAEHOSTDOWN': 10064, 'WSAEHOSTUNREACH': 10065, 'WSAEINPROGRESS': 10036, 'WSAEINTR': 10004, 'WSAEINVAL': 10022, 'WSAEISCONN': 10056, 'WSAELOOP': 10062, 'WSAEMFILE': 10024, 'WSAEMSGSIZE': 10040, 'WSAENAMETOOLONG': 10063, 'WSAENETDOWN': 10050, 'WSAENETRESET': 10052, 'WSAENETUNREACH': 10051, 'WSAENOBUFS': 10055, 'WSAENOPROTOOPT': 10042, 'WSAENOTCONN': 10057, 'WSAENOTEMPTY': 10066, 'WSAENOTSOCK': 10038, 'WSAEOPNOTSUPP': 10045, 'WSAEPFNOSUPPORT': 10046, 'WSAEPROCLIM': 10067, 'WSAEPROTONOSUPPORT': 10043, 'WSAEPROTOTYPE': 10041, 'WSAEREMOTE': 10071, 'WSAESHUTDOWN': 10058, 'WSAESOCKTNOSUPPORT': 10044, 'WSAESTALE': 10070, 'WSAETIMEDOUT': 10060, 'WSAETOOMANYREFS': 10059, 'WSAEUSERS': 10068, 'WSAEWOULDBLOCK': 10035, 'WSANOTINITIALISED': 10093, 'WSASYSNOTREADY': 10091, 'WSAVERNOTSUPPORTED': 10092}
        self.compare_values(cpython_errorval)

    @unittest.skipUnless(is_osx, "OSX specific test")
    def test_errno_codes_osx(self):
        # CPython 3.9.13 on macOS 12.4

        # python3 -c 'import errno;print(errno.errorcode)'
        cpython_errorcode = {19: 'ENODEV', 65: 'EHOSTUNREACH', 91: 'ENOMSG', 96: 'ENODATA', 15: 'ENOTBLK', 78: 'ENOSYS', 32: 'EPIPE', 22: 'EINVAL', 84: 'EOVERFLOW', 4: 'EINTR', 68: 'EUSERS', 66: 'ENOTEMPTY', 55: 'ENOBUFS', 100: 'EPROTO', 71: 'EREMOTE', 10: 'ECHILD', 62: 'ELOOP', 18: 'EXDEV', 7: 'E2BIG', 3: 'ESRCH', 40: 'EMSGSIZE', 47: 'EAFNOSUPPORT', 64: 'EHOSTDOWN', 46: 'EPFNOSUPPORT', 42: 'ENOPROTOOPT', 16: 'EBUSY', 35: 'EAGAIN', 56: 'EISCONN', 58: 'ESHUTDOWN', 9: 'EBADF', 95: 'EMULTIHOP', 5: 'EIO', 41: 'EPROTOTYPE', 28: 'ENOSPC', 8: 'ENOEXEC', 37: 'EALREADY', 50: 'ENETDOWN', 13: 'EACCES', 92: 'EILSEQ', 20: 'ENOTDIR', 1: 'EPERM', 33: 'EDOM', 61: 'ECONNREFUSED', 21: 'EISDIR', 43: 'EPROTONOSUPPORT', 30: 'EROFS', 49: 'EADDRNOTAVAIL', 90: 'EIDRM', 94: 'EBADMSG', 23: 'ENFILE', 29: 'ESPIPE', 97: 'ENOLINK', 52: 'ENETRESET', 60: 'ETIMEDOUT', 2: 'ENOENT', 17: 'EEXIST', 69: 'EDQUOT', 99: 'ENOSTR', 14: 'EFAULT', 27: 'EFBIG', 11: 'EDEADLK', 57: 'ENOTCONN', 39: 'EDESTADDRREQ', 77: 'ENOLCK', 53: 'ECONNABORTED', 51: 'ENETUNREACH', 70: 'ESTALE', 98: 'ENOSR', 12: 'ENOMEM', 38: 'ENOTSOCK', 31: 'EMLINK', 34: 'ERANGE', 54: 'ECONNRESET', 48: 'EADDRINUSE', 102: 'EOPNOTSUPP', 63: 'ENAMETOOLONG', 25: 'ENOTTY', 44: 'ESOCKTNOSUPPORT', 101: 'ETIME', 59: 'ETOOMANYREFS', 24: 'EMFILE', 26: 'ETXTBSY', 36: 'EINPROGRESS', 6: 'ENXIO', 89: 'ECANCELED', 105: 'EOWNERDEAD', 104: 'ENOTRECOVERABLE', 45: 'ENOTSUP', 80: 'EAUTH', 86: 'EBADARCH', 85: 'EBADEXEC', 88: 'EBADMACHO', 72: 'EBADRPC', 83: 'EDEVERR', 79: 'EFTYPE', 81: 'ENEEDAUTH', 93: 'ENOATTR', 103: 'ENOPOLICY', 67: 'EPROCLIM', 76: 'EPROCUNAVAIL', 75: 'EPROGMISMATCH', 74: 'EPROGUNAVAIL', 82: 'EPWROFF', 73: 'ERPCMISMATCH', 87: 'ESHLIBVERS'}
        self.compare_codes(cpython_errorcode)

        # python3 -c 'import errno;print({s:getattr(errno, s) for s in dir(errno) if s.isupper()})'
        cpython_errorval = {'E2BIG': 7, 'EACCES': 13, 'EADDRINUSE': 48, 'EADDRNOTAVAIL': 49, 'EAFNOSUPPORT': 47, 'EAGAIN': 35, 'EALREADY': 37, 'EAUTH': 80, 'EBADARCH': 86, 'EBADEXEC': 85, 'EBADF': 9, 'EBADMACHO': 88, 'EBADMSG': 94, 'EBADRPC': 72, 'EBUSY': 16, 'ECANCELED': 89, 'ECHILD': 10, 'ECONNABORTED': 53, 'ECONNREFUSED': 61, 'ECONNRESET': 54, 'EDEADLK': 11, 'EDESTADDRREQ': 39, 'EDEVERR': 83, 'EDOM': 33, 'EDQUOT': 69, 'EEXIST': 17, 'EFAULT': 14, 'EFBIG': 27, 'EFTYPE': 79, 'EHOSTDOWN': 64, 'EHOSTUNREACH': 65, 'EIDRM': 90, 'EILSEQ': 92, 'EINPROGRESS': 36, 'EINTR': 4, 'EINVAL': 22, 'EIO': 5, 'EISCONN': 56, 'EISDIR': 21, 'ELOOP': 62, 'EMFILE': 24, 'EMLINK': 31, 'EMSGSIZE': 40, 'EMULTIHOP': 95, 'ENAMETOOLONG': 63, 'ENEEDAUTH': 81, 'ENETDOWN': 50, 'ENETRESET': 52, 'ENETUNREACH': 51, 'ENFILE': 23, 'ENOATTR': 93, 'ENOBUFS': 55, 'ENODATA': 96, 'ENODEV': 19, 'ENOENT': 2, 'ENOEXEC': 8, 'ENOLCK': 77, 'ENOLINK': 97, 'ENOMEM': 12, 'ENOMSG': 91, 'ENOPOLICY': 103, 'ENOPROTOOPT': 42, 'ENOSPC': 28, 'ENOSR': 98, 'ENOSTR': 99, 'ENOSYS': 78, 'ENOTBLK': 15, 'ENOTCONN': 57, 'ENOTDIR': 20, 'ENOTEMPTY': 66, 'ENOTRECOVERABLE': 104, 'ENOTSOCK': 38, 'ENOTSUP': 45, 'ENOTTY': 25, 'ENXIO': 6, 'EOPNOTSUPP': 102, 'EOVERFLOW': 84, 'EOWNERDEAD': 105, 'EPERM': 1, 'EPFNOSUPPORT': 46, 'EPIPE': 32, 'EPROCLIM': 67, 'EPROCUNAVAIL': 76, 'EPROGMISMATCH': 75, 'EPROGUNAVAIL': 74, 'EPROTO': 100, 'EPROTONOSUPPORT': 43, 'EPROTOTYPE': 41, 'EPWROFF': 82, 'ERANGE': 34, 'EREMOTE': 71, 'EROFS': 30, 'ERPCMISMATCH': 73, 'ESHLIBVERS': 87, 'ESHUTDOWN': 58, 'ESOCKTNOSUPPORT': 44, 'ESPIPE': 29, 'ESRCH': 3, 'ESTALE': 70, 'ETIME': 101, 'ETIMEDOUT': 60, 'ETOOMANYREFS': 59, 'ETXTBSY': 26, 'EUSERS': 68, 'EWOULDBLOCK': 35, 'EXDEV': 18}
        self.compare_values(cpython_errorval)

    @unittest.skipUnless(is_linux, "Linux specific test")
    def test_errno_codes_linux(self):
        # CPython 3.8 on Linux 5.10.102
        # python3 -c 'import errno;print(errno.errorcode)'
        cpython_errorcode = {19: 'ENODEV', 50: 'ENOCSI', 113: 'EHOSTUNREACH', 42: 'ENOMSG', 117: 'EUCLEAN', 45: 'EL2NSYNC', 51: 'EL2HLT', 61: 'ENODATA', 15: 'ENOTBLK', 38: 'ENOSYS', 32: 'EPIPE', 22: 'EINVAL', 75: 'EOVERFLOW', 68: 'EADV', 4: 'EINTR', 87: 'EUSERS', 39: 'ENOTEMPTY', 105: 'ENOBUFS', 71: 'EPROTO', 66: 'EREMOTE', 119: 'ENAVAIL', 10: 'ECHILD', 40: 'ELOOP', 18: 'EXDEV', 7: 'E2BIG', 3: 'ESRCH', 90: 'EMSGSIZE', 97: 'EAFNOSUPPORT', 53: 'EBADR', 112: 'EHOSTDOWN', 96: 'EPFNOSUPPORT', 92: 'ENOPROTOOPT', 16: 'EBUSY', 11: 'EAGAIN', 77: 'EBADFD', 73: 'EDOTDOT', 106: 'EISCONN', 55: 'ENOANO', 108: 'ESHUTDOWN', 44: 'ECHRNG', 80: 'ELIBBAD', 64: 'ENONET', 52: 'EBADE', 9: 'EBADF', 72: 'EMULTIHOP', 5: 'EIO', 49: 'EUNATCH', 91: 'EPROTOTYPE', 28: 'ENOSPC', 8: 'ENOEXEC', 114: 'EALREADY', 100: 'ENETDOWN', 118: 'ENOTNAM', 13: 'EACCES', 48: 'ELNRNG', 84: 'EILSEQ', 20: 'ENOTDIR', 76: 'ENOTUNIQ', 1: 'EPERM', 33: 'EDOM', 54: 'EXFULL', 111: 'ECONNREFUSED', 21: 'EISDIR', 93: 'EPROTONOSUPPORT', 30: 'EROFS', 99: 'EADDRNOTAVAIL', 43: 'EIDRM', 70: 'ECOMM', 69: 'ESRMNT', 121: 'EREMOTEIO', 47: 'EL3RST', 74: 'EBADMSG', 23: 'ENFILE', 82: 'ELIBMAX', 29: 'ESPIPE', 67: 'ENOLINK', 102: 'ENETRESET', 110: 'ETIMEDOUT', 2: 'ENOENT', 17: 'EEXIST', 122: 'EDQUOT', 60: 'ENOSTR', 57: 'EBADSLT', 56: 'EBADRQC', 79: 'ELIBACC', 14: 'EFAULT', 27: 'EFBIG', 35: 'EDEADLOCK', 107: 'ENOTCONN', 89: 'EDESTADDRREQ', 81: 'ELIBSCN', 37: 'ENOLCK', 120: 'EISNAM', 103: 'ECONNABORTED', 101: 'ENETUNREACH', 116: 'ESTALE', 63: 'ENOSR', 12: 'ENOMEM', 88: 'ENOTSOCK', 86: 'ESTRPIPE', 31: 'EMLINK', 34: 'ERANGE', 83: 'ELIBEXEC', 46: 'EL3HLT', 104: 'ECONNRESET', 98: 'EADDRINUSE', 95: 'ENOTSUP', 78: 'EREMCHG', 36: 'ENAMETOOLONG', 25: 'ENOTTY', 85: 'ERESTART', 94: 'ESOCKTNOSUPPORT', 62: 'ETIME', 59: 'EBFONT', 109: 'ETOOMANYREFS', 24: 'EMFILE', 26: 'ETXTBSY', 115: 'EINPROGRESS', 6: 'ENXIO', 65: 'ENOPKG', 123: 'ENOMEDIUM', 124: 'EMEDIUMTYPE', 125: 'ECANCELED', 126: 'ENOKEY', 127: 'EKEYEXPIRED', 128: 'EKEYREVOKED', 129: 'EKEYREJECTED', 130: 'EOWNERDEAD', 131: 'ENOTRECOVERABLE', 132: 'ERFKILL'}
        self.compare_codes(cpython_errorcode)

        # python3 -c 'import errno;print({s:getattr(errno, s) for s in dir(errno) if s.isupper()})'
        cpython_errorval = {'E2BIG': 7, 'EACCES': 13, 'EADDRINUSE': 98, 'EADDRNOTAVAIL': 99, 'EADV': 68, 'EAFNOSUPPORT': 97, 'EAGAIN': 11, 'EALREADY': 114, 'EBADE': 52, 'EBADF': 9, 'EBADFD': 77, 'EBADMSG': 74, 'EBADR': 53, 'EBADRQC': 56, 'EBADSLT': 57, 'EBFONT': 59, 'EBUSY': 16, 'ECANCELED': 125, 'ECHILD': 10, 'ECHRNG': 44, 'ECOMM': 70, 'ECONNABORTED': 103, 'ECONNREFUSED': 111, 'ECONNRESET': 104, 'EDEADLK': 35, 'EDEADLOCK': 35, 'EDESTADDRREQ': 89, 'EDOM': 33, 'EDOTDOT': 73, 'EDQUOT': 122, 'EEXIST': 17, 'EFAULT': 14, 'EFBIG': 27, 'EHOSTDOWN': 112, 'EHOSTUNREACH': 113, 'EIDRM': 43, 'EILSEQ': 84, 'EINPROGRESS': 115, 'EINTR': 4, 'EINVAL': 22, 'EIO': 5, 'EISCONN': 106, 'EISDIR': 21, 'EISNAM': 120, 'EKEYEXPIRED': 127, 'EKEYREJECTED': 129, 'EKEYREVOKED': 128, 'EL2HLT': 51, 'EL2NSYNC': 45, 'EL3HLT': 46, 'EL3RST': 47, 'ELIBACC': 79, 'ELIBBAD': 80, 'ELIBEXEC': 83, 'ELIBMAX': 82, 'ELIBSCN': 81, 'ELNRNG': 48, 'ELOOP': 40, 'EMEDIUMTYPE': 124, 'EMFILE': 24, 'EMLINK': 31, 'EMSGSIZE': 90, 'EMULTIHOP': 72, 'ENAMETOOLONG': 36, 'ENAVAIL': 119, 'ENETDOWN': 100, 'ENETRESET': 102, 'ENETUNREACH': 101, 'ENFILE': 23, 'ENOANO': 55, 'ENOBUFS': 105, 'ENOCSI': 50, 'ENODATA': 61, 'ENODEV': 19, 'ENOENT': 2, 'ENOEXEC': 8, 'ENOKEY': 126, 'ENOLCK': 37, 'ENOLINK': 67, 'ENOMEDIUM': 123, 'ENOMEM': 12, 'ENOMSG': 42, 'ENONET': 64, 'ENOPKG': 65, 'ENOPROTOOPT': 92, 'ENOSPC': 28, 'ENOSR': 63, 'ENOSTR': 60, 'ENOSYS': 38, 'ENOTBLK': 15, 'ENOTCONN': 107, 'ENOTDIR': 20, 'ENOTEMPTY': 39, 'ENOTNAM': 118, 'ENOTRECOVERABLE': 131, 'ENOTSOCK': 88, 'ENOTSUP': 95, 'ENOTTY': 25, 'ENOTUNIQ': 76, 'ENXIO': 6, 'EOPNOTSUPP': 95, 'EOVERFLOW': 75, 'EOWNERDEAD': 130, 'EPERM': 1, 'EPFNOSUPPORT': 96, 'EPIPE': 32, 'EPROTO': 71, 'EPROTONOSUPPORT': 93, 'EPROTOTYPE': 91, 'ERANGE': 34, 'EREMCHG': 78, 'EREMOTE': 66, 'EREMOTEIO': 121, 'ERESTART': 85, 'ERFKILL': 132, 'EROFS': 30, 'ESHUTDOWN': 108, 'ESOCKTNOSUPPORT': 94, 'ESPIPE': 29, 'ESRCH': 3, 'ESRMNT': 69, 'ESTALE': 116, 'ESTRPIPE': 86, 'ETIME': 62, 'ETIMEDOUT': 110, 'ETOOMANYREFS': 109, 'ETXTBSY': 26, 'EUCLEAN': 117, 'EUNATCH': 49, 'EUSERS': 87, 'EWOULDBLOCK': 11, 'EXDEV': 18, 'EXFULL': 54}
        self.compare_values(cpython_errorval)

    def test_code_values(self):
        for code in errno.errorcode:
            self.assertEqual(getattr(errno, errno.errorcode[code]), code)

run_test(__name__)
