mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
gh-109466: Add ipv6_mapped property to IPv4Address (#109467)
Adds the `IPv4Address.ipv6_mapped` property. Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
This commit is contained in:
parent
24b5cbd3dc
commit
ba8aa1fd37
5 changed files with 32 additions and 0 deletions
|
@ -303,6 +303,14 @@ class AddressTestCase_v4(BaseTestCase, CommonTestMixin_v4):
|
|||
def test_weakref(self):
|
||||
weakref.ref(self.factory('192.0.2.1'))
|
||||
|
||||
def test_ipv6_mapped(self):
|
||||
self.assertEqual(ipaddress.IPv4Address('192.168.1.1').ipv6_mapped,
|
||||
ipaddress.IPv6Address('::ffff:192.168.1.1'))
|
||||
self.assertEqual(ipaddress.IPv4Address('192.168.1.1').ipv6_mapped,
|
||||
ipaddress.IPv6Address('::ffff:c0a8:101'))
|
||||
self.assertEqual(ipaddress.IPv4Address('192.168.1.1').ipv6_mapped.ipv4_mapped,
|
||||
ipaddress.IPv4Address('192.168.1.1'))
|
||||
|
||||
|
||||
class AddressTestCase_v6(BaseTestCase, CommonTestMixin_v6):
|
||||
factory = ipaddress.IPv6Address
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue