summaryrefslogtreecommitdiff
path: root/tests/test_ntoaaton.py
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2020-06-13 11:40:54 -0700
committerBob Halley <halley@dnspython.org>2020-06-13 11:40:54 -0700
commit92b5b2d4a660a509aba0b818cf1889eb6d76c09e (patch)
tree19fa9ad78c521a2e41237a54637cc40c01006690 /tests/test_ntoaaton.py
parentdfff63e1d4cefc8af15abe37e9b8cce39951ac72 (diff)
downloaddnspython-async.tar.gz
Change parameter order of low_level_address_tuple; add test coverage.async
Diffstat (limited to 'tests/test_ntoaaton.py')
-rw-r--r--tests/test_ntoaaton.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_ntoaaton.py b/tests/test_ntoaaton.py
index 36107e1..3a72891 100644
--- a/tests/test_ntoaaton.py
+++ b/tests/test_ntoaaton.py
@@ -17,6 +17,7 @@
import unittest
import binascii
+import socket
import dns.exception
import dns.ipv4
@@ -274,5 +275,19 @@ class NtoAAtoNTestCase(unittest.TestCase):
('2001:db8:0:1:1:1:1:q1', False)]:
self.assertEqual(dns.inet.is_address(t), e)
+ def test_low_level_address_tuple(self):
+ t = dns.inet.low_level_address_tuple(('1.2.3.4', 53))
+ self.assertEqual(t, ('1.2.3.4', 53))
+ t = dns.inet.low_level_address_tuple(('2600::1', 53))
+ self.assertEqual(t, ('2600::1', 53, 0, 0))
+ t = dns.inet.low_level_address_tuple(('1.2.3.4', 53), socket.AF_INET)
+ self.assertEqual(t, ('1.2.3.4', 53))
+ t = dns.inet.low_level_address_tuple(('2600::1', 53), socket.AF_INET6)
+ self.assertEqual(t, ('2600::1', 53, 0, 0))
+ def bad():
+ bogus = socket.AF_INET + socket.AF_INET6 + 1
+ t = dns.inet.low_level_address_tuple(('2600::1', 53), bogus)
+ self.assertRaises(NotImplementedError, bad)
+
if __name__ == '__main__':
unittest.main()