Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_errorcode_dict(self):
for err in ('ARES_SUCCESS', 'ARES_ENODATA', 'ARES_ECANCELLED'):
val = getattr(pycares.errno, err)
self.assertEqual(pycares.errno.errorcode[val], err)
def test_strerror_str(self):
for key in pycares.errno.errorcode:
self.assertTrue(type(pycares.errno.strerror(key)), str)
def __init__(self, errno):
str_error = pycares.errno.strerror(errno)
if isinstance(str_error, bytes):
str_error = str_error.decode('utf-8')
msg = '{0} [{1}]'.format(str_error, pycares.errno.errorcode[errno])
super(DNSError, self).__init__(msg)
self.errno = errno