Skip to content

Commit 855c57e

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 9184b1b commit 855c57e

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
@@ -894,8 +894,8 @@ class ComparisonTests(unittest.TestCase):
894894
v6net = ipaddress.IPv6Network(1)
895895
v6intf = ipaddress.IPv6Interface(1)
896896
v6addr_scoped = ipaddress.IPv6Address('::1%scope')
897-
v6net_scoped= ipaddress.IPv6Network('::1%scope')
898-
v6intf_scoped= ipaddress.IPv6Interface('::1%scope')
897+
v6net_scoped = ipaddress.IPv6Network('::1%scope')
898+
v6intf_scoped = ipaddress.IPv6Interface('::1%scope')
899899

900900
v4_addresses = [v4addr, v4intf]
901901
v4_objects = v4_addresses + [v4net]
@@ -1083,6 +1083,7 @@ def setUp(self):
10831083
self.ipv6_scoped_interface = ipaddress.IPv6Interface(
10841084
'2001:658:22a:cafe:200:0:0:1%scope/64')
10851085
self.ipv6_scoped_network = ipaddress.IPv6Network('2001:658:22a:cafe::%scope/64')
1086+
self.ipv6_with_ipv4_part = ipaddress.IPv6Interface('::1.2.3.4')
10861087

10871088
def testRepr(self):
10881089
self.assertEqual("IPv4Interface('1.2.3.4/32')",
@@ -1713,6 +1714,8 @@ def testEqual(self):
17131714

17141715
self.assertTrue(self.ipv6_scoped_interface ==
17151716
ipaddress.IPv6Interface('2001:658:22a:cafe:200::1%scope/64'))
1717+
self.assertTrue(self.ipv6_with_ipv4_part ==
1718+
ipaddress.IPv6Interface('0000:0000:0000:0000:0000:0000:0102:0304'))
17161719
self.assertFalse(self.ipv6_scoped_interface ==
17171720
ipaddress.IPv6Interface('2001:658:22a:cafe:200::1%scope/63'))
17181721
self.assertFalse(self.ipv6_scoped_interface ==
@@ -2192,6 +2195,7 @@ def testIPVersion(self):
21922195
self.assertEqual(self.ipv4_address.version, 4)
21932196
self.assertEqual(self.ipv6_address.version, 6)
21942197
self.assertEqual(self.ipv6_scoped_address.version, 6)
2198+
self.assertEqual(self.ipv6_with_ipv4_part.version, 6)
21952199

21962200
def testMaxPrefixLength(self):
21972201
self.assertEqual(self.ipv4_interface.max_prefixlen, 32)

0 commit comments

Comments
 (0)