diff options
Diffstat (limited to 'netaddr/tests/ip/test_ip_rfc1924.py')
-rw-r--r-- | netaddr/tests/ip/test_ip_rfc1924.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/netaddr/tests/ip/test_ip_rfc1924.py b/netaddr/tests/ip/test_ip_rfc1924.py new file mode 100644 index 0000000..8e2761f --- /dev/null +++ b/netaddr/tests/ip/test_ip_rfc1924.py @@ -0,0 +1,17 @@ +import pytest + +from netaddr import AddrFormatError +from netaddr.ip.rfc1924 import ipv6_to_base85, base85_to_ipv6 + + +def test_RFC_1924(): + ip_addr = '1080::8:800:200c:417a' + base85 = ipv6_to_base85(ip_addr) + assert base85 == '4)+k&C#VzJ4br>0wv%Yp' + assert base85_to_ipv6(base85) == '1080::8:800:200c:417a' + + # RFC specifies that "leading zeroes are never omitted" + ipv6_to_base85("::1") == '00000000000000000001' + + with pytest.raises(AddrFormatError): + base85_to_ipv6('not 20 chars') |