Skip to content

Commit 0cc5ace

Browse files
authored
Add Test for IPv6 ipv4_translation
1 parent f492f39 commit 0cc5ace

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Lib/test/test_ipaddress.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2623,6 +2623,16 @@ def testsixtofour(self):
26232623
sixtofouraddr.sixtofour)
26242624
self.assertFalse(bad_addr.sixtofour)
26252625

2626+
def testipv4_translation(self):
2627+
embedded_rfc6052 = ipaddress.ip_address('64:ff9b::172.29.45.100')
2628+
embedded_rfc8215 = ipaddress.ip_address('64:ff9b:1::172.29.45.100')
2629+
bad_addr = ipaddress.ip_address('2001:db8::172.29.45.100')
2630+
self.assertEqual(ipaddress.IPv4Address('172.29.45.100'),
2631+
embedded_rfc6052.ipv4_translation)
2632+
self.assertEqual(ipaddress.IPv4Address('172.29.45.100'),
2633+
embedded_rfc8215.ipv4_translation)
2634+
self.assertFalse(bad_addr.ipv4_translation)
2635+
26262636
# issue41004 Hash collisions in IPv4Interface and IPv6Interface
26272637
def testV4HashIsNotConstant(self):
26282638
ipv4_address1 = ipaddress.IPv4Interface("1.2.3.4")

0 commit comments

Comments
 (0)