Skip to content

Commit 8b67270

Browse files
bazhilmiss-islington
authored andcommitted
pythongh-130607: Extend and cleanup IPv6 tests (pythonGH-121518)
Extend IPv6 tests and made little syntax refactoring (cherry picked from commit 9f0879b) Co-authored-by: Ilya Bazhenov <31971067+bazhil@users.noreply.github.com>
1 parent 4eb1421 commit 8b67270

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Lib/test/test_ipaddress.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -886,8 +886,8 @@ class ComparisonTests(unittest.TestCase):
886886
v6net = ipaddress.IPv6Network(1)
887887
v6intf = ipaddress.IPv6Interface(1)
888888
v6addr_scoped = ipaddress.IPv6Address('::1%scope')
889-
v6net_scoped= ipaddress.IPv6Network('::1%scope')
890-
v6intf_scoped= ipaddress.IPv6Interface('::1%scope')
889+
v6net_scoped = ipaddress.IPv6Network('::1%scope')
890+
v6intf_scoped = ipaddress.IPv6Interface('::1%scope')
891891

892892
v4_addresses = [v4addr, v4intf]
893893
v4_objects = v4_addresses + [v4net]
@@ -1075,6 +1075,7 @@ def setUp(self):
10751075
self.ipv6_scoped_interface = ipaddress.IPv6Interface(
10761076
'2001:658:22a:cafe:200:0:0:1%scope/64')
10771077
self.ipv6_scoped_network = ipaddress.IPv6Network('2001:658:22a:cafe::%scope/64')
1078+
self.ipv6_with_ipv4_part = ipaddress.IPv6Interface('::1.2.3.4')
10781079

10791080
def testRepr(self):
10801081
self.assertEqual("IPv4Interface('1.2.3.4/32')",
@@ -1694,6 +1695,8 @@ def testEqual(self):
16941695

16951696
self.assertTrue(self.ipv6_scoped_interface ==
16961697
ipaddress.IPv6Interface('2001:658:22a:cafe:200::1%scope/64'))
1698+
self.assertTrue(self.ipv6_with_ipv4_part ==
1699+
ipaddress.IPv6Interface('0000:0000:0000:0000:0000:0000:0102:0304'))
16971700
self.assertFalse(self.ipv6_scoped_interface ==
16981701
ipaddress.IPv6Interface('2001:658:22a:cafe:200::1%scope/63'))
16991702
self.assertFalse(self.ipv6_scoped_interface ==
@@ -2173,6 +2176,7 @@ def testIPVersion(self):
21732176
self.assertEqual(self.ipv4_address.version, 4)
21742177
self.assertEqual(self.ipv6_address.version, 6)
21752178
self.assertEqual(self.ipv6_scoped_address.version, 6)
2179+
self.assertEqual(self.ipv6_with_ipv4_part.version, 6)
21762180

21772181
def testMaxPrefixLength(self):
21782182
self.assertEqual(self.ipv4_interface.max_prefixlen, 32)

0 commit comments

Comments
 (0)