netwatch.py/netaddr-0.7.10/netaddr/tests/2.x/ip/platform_win32.txt

93 lines
2.3 KiB
Plaintext
Raw Normal View History

2015-03-27 22:54:25 +00:00
=Windows 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('::2/127')
IPNetwork('::4/126')
IPNetwork('::8/125')
IPNetwork('::10/124')
IPNetwork('::20/123')
IPNetwork('::40/122')
IPNetwork('::80/121')
IPNetwork('::100/120')
IPNetwork('::200/119')
IPNetwork('::400/118')
IPNetwork('::800/117')
IPNetwork('::1000/116')
IPNetwork('::2000/115')
IPNetwork('::4000/114')
IPNetwork('::8000/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')
# Sadly, inet_pton cannot help us here ...
>>> IPAddress('010.000.000.001', flags=INET_PTON)
Traceback (most recent call last):
...
AddrFormatError: failed to detect a valid IP address from '010.000.000.001'
>>> from netaddr.strategy.ipv6 import int_to_str
>>> int_to_str(0xffff)
'::ffff'
}}}