add doctest for IPv6 mapped IPv4 addresses
This commit is contained in:
parent
26b9088c9d
commit
a728d3e32d
@ -28,6 +28,8 @@ def anonymize(remote_addr):
|
|||||||
'12.34.56.0'
|
'12.34.56.0'
|
||||||
>>> anonymize(u'1234:5678:90ab:cdef:fedc:ba09:8765:4321') # doctest: +IGNORE_UNICODE
|
>>> anonymize(u'1234:5678:90ab:cdef:fedc:ba09:8765:4321') # doctest: +IGNORE_UNICODE
|
||||||
'1234:5678:90ab:0000:0000:0000:0000:0000'
|
'1234:5678:90ab:0000:0000:0000:0000:0000'
|
||||||
|
>>> anonymize(u'::ffff:127.0.0.1') # doctest: +IGNORE_UNICODE
|
||||||
|
'127.0.0.0'
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
ipv4 = ipaddress.IPv4Address(remote_addr)
|
ipv4 = ipaddress.IPv4Address(remote_addr)
|
||||||
|
Loading…
Reference in New Issue
Block a user