]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
add coverage for a v6 branch case
authorBob Halley <halley@dnspython.org>
Thu, 23 Jul 2020 02:03:50 +0000 (19:03 -0700)
committerBob Halley <halley@dnspython.org>
Thu, 23 Jul 2020 02:03:50 +0000 (19:03 -0700)
tests/test_ntoaaton.py

index d256c1c031dae972aaf1a3ec9dc4c56eb0ad5bb1..7e30bce2417cbe91fafcad4de0c56bf622e98b25 100644 (file)
@@ -163,6 +163,12 @@ class NtoAAtoNTestCase(unittest.TestCase):
         t = ntoa6(b)
         self.assertEqual(t, '::0.1.255.255')
 
+    def test_ntoa15(self):
+        # This exercises the current_len > best_len branch in the <= case.
+        b = binascii.unhexlify(b'0000ffff00000000ffff00000000ffff')
+        t = ntoa6(b)
+        self.assertEqual(t, '0:ffff::ffff:0:0:ffff')
+
     def test_bad_ntoa1(self):
         def bad():
             ntoa6(b'')