diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py index 704a38ea522c0c..bdb4eb1486aff0 100644 --- a/Lib/test/test_ipaddress.py +++ b/Lib/test/test_ipaddress.py @@ -1325,13 +1325,13 @@ def testIPv6IPv4MappedStringRepresentation(self): long_prefix = '0000:0000:0000:0000:0000:ffff:' ipv4 = '1.2.3.4' for short_prefix in ('::ffff:', '::'): - ipv6_ipv4_mapped_str = '%s%s' % (short_prefix, ipv4) - with self.subTest(addr=ipv6_ipv4_mapped_str): - ipv6_ipv4_mapped_address = ipaddress.IPv6Address(ipv6_ipv4_mapped_str) - ipv6_ipv4_mapped_interface = ipaddress.IPv6Interface(ipv6_ipv4_mapped_str) - self.assertEqual(str(ipv6_ipv4_mapped_address), ipv6_ipv4_mapped_str) - self.assertEqual(ipv6_ipv4_mapped_address.exploded, long_prefix + ipv4) - self.assertEqual(str(ipv6_ipv4_mapped_interface.ip), ipv6_ipv4_mapped_str) + ipv6_ipv4_str = '%s%s' % (short_prefix, ipv4) + with self.subTest(addr=ipv6_ipv4_str): + ipv6_ipv4_addr = ipaddress.IPv6Address(ipv6_ipv4_str) + ipv6_ipv4_iface = ipaddress.IPv6Interface(ipv6_ipv4_str) + self.assertEqual(str(ipv6_ipv4_addr), ipv6_ipv4_str) + self.assertEqual(ipv6_ipv4_addr.exploded, long_prefix + ipv4) + self.assertEqual(str(ipv6_ipv4_iface.ip), ipv6_ipv4_str) def testGetScopeId(self): self.assertEqual(self.ipv6_address.scope_id,