91 lines
2.3 KiB
Plaintext
91 lines
2.3 KiB
Plaintext
=Mac OSX Specific Tests=
|
|
|
|
Copyright (c) 2008-2012, David P. D. Moss. All rights reserved.
|
|
|
|
{{{
|
|
|
|
>>> from netaddr import *
|
|
|
|
}}}
|
|
|
|
Worst case IPv4 compatible IPv6 range to CIDR.
|
|
|
|
{{{
|
|
|
|
>>> for ip in iprange_to_cidrs('::1', '::255.255.255.254'):
|
|
... ip
|
|
...
|
|
IPNetwork('::1/128')
|
|
IPNetwork('::0.0.0.2/127')
|
|
IPNetwork('::0.0.0.4/126')
|
|
IPNetwork('::0.0.0.8/125')
|
|
IPNetwork('::0.0.0.16/124')
|
|
IPNetwork('::0.0.0.32/123')
|
|
IPNetwork('::0.0.0.64/122')
|
|
IPNetwork('::0.0.0.128/121')
|
|
IPNetwork('::0.0.1.0/120')
|
|
IPNetwork('::0.0.2.0/119')
|
|
IPNetwork('::0.0.4.0/118')
|
|
IPNetwork('::0.0.8.0/117')
|
|
IPNetwork('::0.0.16.0/116')
|
|
IPNetwork('::0.0.32.0/115')
|
|
IPNetwork('::0.0.64.0/114')
|
|
IPNetwork('::0.0.128.0/113')
|
|
IPNetwork('::0.1.0.0/112')
|
|
IPNetwork('::0.2.0.0/111')
|
|
IPNetwork('::0.4.0.0/110')
|
|
IPNetwork('::0.8.0.0/109')
|
|
IPNetwork('::0.16.0.0/108')
|
|
IPNetwork('::0.32.0.0/107')
|
|
IPNetwork('::0.64.0.0/106')
|
|
IPNetwork('::0.128.0.0/105')
|
|
IPNetwork('::1.0.0.0/104')
|
|
IPNetwork('::2.0.0.0/103')
|
|
IPNetwork('::4.0.0.0/102')
|
|
IPNetwork('::8.0.0.0/101')
|
|
IPNetwork('::16.0.0.0/100')
|
|
IPNetwork('::32.0.0.0/99')
|
|
IPNetwork('::64.0.0.0/98')
|
|
IPNetwork('::128.0.0.0/98')
|
|
IPNetwork('::192.0.0.0/99')
|
|
IPNetwork('::224.0.0.0/100')
|
|
IPNetwork('::240.0.0.0/101')
|
|
IPNetwork('::248.0.0.0/102')
|
|
IPNetwork('::252.0.0.0/103')
|
|
IPNetwork('::254.0.0.0/104')
|
|
IPNetwork('::255.0.0.0/105')
|
|
IPNetwork('::255.128.0.0/106')
|
|
IPNetwork('::255.192.0.0/107')
|
|
IPNetwork('::255.224.0.0/108')
|
|
IPNetwork('::255.240.0.0/109')
|
|
IPNetwork('::255.248.0.0/110')
|
|
IPNetwork('::255.252.0.0/111')
|
|
IPNetwork('::255.254.0.0/112')
|
|
IPNetwork('::255.255.0.0/113')
|
|
IPNetwork('::255.255.128.0/114')
|
|
IPNetwork('::255.255.192.0/115')
|
|
IPNetwork('::255.255.224.0/116')
|
|
IPNetwork('::255.255.240.0/117')
|
|
IPNetwork('::255.255.248.0/118')
|
|
IPNetwork('::255.255.252.0/119')
|
|
IPNetwork('::255.255.254.0/120')
|
|
IPNetwork('::255.255.255.0/121')
|
|
IPNetwork('::255.255.255.128/122')
|
|
IPNetwork('::255.255.255.192/123')
|
|
IPNetwork('::255.255.255.224/124')
|
|
IPNetwork('::255.255.255.240/125')
|
|
IPNetwork('::255.255.255.248/126')
|
|
IPNetwork('::255.255.255.252/127')
|
|
IPNetwork('::255.255.255.254/128')
|
|
|
|
# inet_pton has to be different on Mac OSX *sigh*
|
|
>>> IPAddress('010.000.000.001', flags=INET_PTON)
|
|
IPAddress('10.0.0.1')
|
|
|
|
>>> from netaddr.strategy.ipv6 import int_to_str
|
|
>>> int_to_str(0xffff)
|
|
'::0.0.255.255'
|
|
|
|
}}}
|
|
|