Skip to content

Commit

Permalink
Merge pull request beeware#803 from wjohnston888/ip
Browse files Browse the repository at this point in the history
Add IP test
  • Loading branch information
eliasdorneles authored May 15, 2018
2 parents cd22c47 + 5f7ab5d commit d8dc771
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions stdlib_tests/test_ipaddress.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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.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 d8dc771

Please sign in to comment.