Skip to content

Commit

Permalink
Add IP test
Browse files Browse the repository at this point in the history
  • Loading branch information
wjohnston888 committed May 14, 2018
1 parent 0b10411 commit 086573f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Binary file added stdlib_tests/python/test_calendar.class
Binary file not shown.
Binary file added stdlib_tests/python/test_ipaddress.class
Binary file not shown.
21 changes: 21 additions & 0 deletions stdlib_tests/test_ipaddress.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import ipaddress

print(ipaddress.IPv4Address('192.168.0.1'))
print(ipaddress.IPv4Address(323223552))
print(ipaddress.IPv4Address(b'\xC0\xA8\x00\x01'))
print(ipaddress.IPv6Address('2001:db8::'))
print(ipaddress.ip_network('192.168.0.0/28'))
print(ipaddress.ip_address("127.0.0.1").reverse_pointer)
print(ipaddress.ip_address("2001:db8::1").reverse_pointer)
print(ipaddress.IPv4Address('127.0.0.2') > ipaddress.IPv4Address('127.0.0.1'))
print(ipaddress.IPv4Address('127.0.0.2') == ipaddress.IPv4Address('127.0.0.1'))
print(ipaddress.IPv4Address('127.0.0.2') != ipaddress.IPv4Address('127.0.0.1'))
print(ipaddress.IPv4Address('127.0.0.2') + 3)
print(ipaddress.IPv4Address('127.0.0.2') - 3)
print(list(ipaddress.ip_network('192.0.2.0/29').hosts()))
print(list(ipaddress.ip_network('192.0.2.0/24').subnets()))
print(ipaddress.ip_network('192.0.2.1/32').compare_networks(ipaddress.ip_network('192.0.2.0/32')))
for addr in ipaddress.IPv4Network('192.0.2.0/28'):
print(addr)
print(ipaddress.IPv4Address('192.0.2.6') in ipaddress.IPv4Network('192.0.2.0/28'))

0 comments on commit 086573f

Please sign in to comment.