def function1168(): assert helpers.is_ip_address(b'127.0.0.1') assert helpers.is_ip_address(b'::1') assert helpers.is_ip_address(b'FE80:0000:0000:0000:0202:B3FF:FE1E:8329') assert (not helpers.is_ip_address(b'localhost')) assert (not helpers.is_ip_address(b'www.example.com')) assert (not helpers.is_ip_address(b'999.999.999.999')) assert (not helpers.is_ip_address(b'127.0.0.1:80')) assert (not helpers.is_ip_address(b'[2001:db8:0:1]:80')) assert (not helpers.is_ip_address(b'1200::AB00:1234::2552:7777:1313'))
def test_host_addresses() -> None: hosts = [ "www.four.part.host" "www.python.org", "foo.bar", "localhost", ] for host in hosts: assert not helpers.is_ip_address(host)
def test_host_addresses() -> None: hosts = [ 'www.four.part.host' 'www.python.org', 'foo.bar', 'localhost', ] for host in hosts: assert not helpers.is_ip_address(host)
def test_host_addresses(self): hosts = [ 'www.four.part.host' 'www.python.org', 'foo.bar', 'localhost', ] for host in hosts: assert helpers.is_ip_address(host) is False
def test_host_addresses(): hosts = [ 'www.four.part.host' 'www.python.org', 'foo.bar', 'localhost', ] for host in hosts: assert not helpers.is_ip_address(host)
def test_ipv4_addresses() -> None: ip_addresses = [ "0.0.0.0", "127.0.0.1", "255.255.255.255", ] for address in ip_addresses: assert helpers.is_ipv4_address(address) assert not helpers.is_ipv6_address(address) assert helpers.is_ip_address(address)
def test_ipv4_addresses() -> None: ip_addresses = [ '0.0.0.0', '127.0.0.1', '255.255.255.255', ] for address in ip_addresses: assert helpers.is_ipv4_address(address) assert not helpers.is_ipv6_address(address) assert helpers.is_ip_address(address)
def test_is_ip_address_bytes(): assert helpers.is_ip_address(b"127.0.0.1") assert helpers.is_ip_address(b"::1") assert helpers.is_ip_address(b"FE80:0000:0000:0000:0202:B3FF:FE1E:8329") # Hostnames assert not helpers.is_ip_address(b"localhost") assert not helpers.is_ip_address(b"www.example.com") # Out of range assert not helpers.is_ip_address(b"999.999.999.999") # Contain a port assert not helpers.is_ip_address(b"127.0.0.1:80") assert not helpers.is_ip_address(b"[2001:db8:0:1]:80") # Too many "::" assert not helpers.is_ip_address(b"1200::AB00:1234::2552:7777:1313")
def test_is_ip_address_bytes() -> None: assert helpers.is_ip_address(b"127.0.0.1") assert helpers.is_ip_address(b"::1") assert helpers.is_ip_address(b"FE80:0000:0000:0000:0202:B3FF:FE1E:8329") # Hostnames assert not helpers.is_ip_address(b"localhost") assert not helpers.is_ip_address(b"www.example.com") # Out of range assert not helpers.is_ip_address(b"999.999.999.999") # Contain a port assert not helpers.is_ip_address(b"127.0.0.1:80") assert not helpers.is_ip_address(b"[2001:db8:0:1]:80") # Too many "::" assert not helpers.is_ip_address(b"1200::AB00:1234::2552:7777:1313")
def function408(): var4620 = [ '0.0.0.0', '127.0.0.1', '255.255.255.255', '0:0:0:0:0:0:0:0', 'FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF', '00AB:0002:3008:8CFD:00AB:0002:3008:8CFD', '00ab:0002:3008:8cfd:00ab:0002:3008:8cfd', 'AB:02:3008:8CFD:AB:02:3008:8CFD', 'AB:02:3008:8CFD::02:3008:8CFD', '::', '1::1' ] for var3426 in var4620: assert helpers.is_ip_address(var3426)
def test_ipv6_addresses() -> None: ip_addresses = [ "0:0:0:0:0:0:0:0", "FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", "00AB:0002:3008:8CFD:00AB:0002:3008:8CFD", "00ab:0002:3008:8cfd:00ab:0002:3008:8cfd", "AB:02:3008:8CFD:AB:02:3008:8CFD", "AB:02:3008:8CFD::02:3008:8CFD", "::", "1::1", ] for address in ip_addresses: assert not helpers.is_ipv4_address(address) assert helpers.is_ipv6_address(address) assert helpers.is_ip_address(address)
def test_ipv6_addresses() -> None: ip_addresses = [ '0:0:0:0:0:0:0:0', 'FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF', '00AB:0002:3008:8CFD:00AB:0002:3008:8CFD', '00ab:0002:3008:8cfd:00ab:0002:3008:8cfd', 'AB:02:3008:8CFD:AB:02:3008:8CFD', 'AB:02:3008:8CFD::02:3008:8CFD', '::', '1::1', ] for address in ip_addresses: assert not helpers.is_ipv4_address(address) assert helpers.is_ipv6_address(address) assert helpers.is_ip_address(address)
def test_ip_addresses(): ip_addresses = [ '0.0.0.0', '127.0.0.1', '255.255.255.255', '0:0:0:0:0:0:0:0', 'FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF', '00AB:0002:3008:8CFD:00AB:0002:3008:8CFD', '00ab:0002:3008:8cfd:00ab:0002:3008:8cfd', 'AB:02:3008:8CFD:AB:02:3008:8CFD', 'AB:02:3008:8CFD::02:3008:8CFD', '::', '1::1', ] for address in ip_addresses: assert helpers.is_ip_address(address)
def test_ip_addresses(self): ip_addresses = [ "0.0.0.0", "127.0.0.1", "255.255.255.255", "0:0:0:0:0:0:0:0", "FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", "00AB:0002:3008:8CFD:00AB:0002:3008:8CFD", "00ab:0002:3008:8cfd:00ab:0002:3008:8cfd", "AB:02:3008:8CFD:AB:02:3008:8CFD", "AB:02:3008:8CFD::02:3008:8CFD", "::", "1::1", ] for address in ip_addresses: assert helpers.is_ip_address(address) is True
def test_is_ip_address_invalid_type() -> None: with pytest.raises(TypeError): helpers.is_ip_address(123) with pytest.raises(TypeError): helpers.is_ip_address(object())
def function45(): var3076 = ['www.four.part.hostwww.python.org', 'foo.bar', 'localhost'] for var3253 in var3076: assert (not helpers.is_ip_address(var3253))
def test_host_addresses(self): hosts = ["www.four.part.host" "www.python.org", "foo.bar", "localhost"] for host in hosts: assert helpers.is_ip_address(host) is False
def function1207(): with pytest.raises(TypeError): helpers.is_ip_address(123) with pytest.raises(TypeError): helpers.is_ip_address(object())
def test_is_ip_address_invalid_type(): with pytest.raises(TypeError): helpers.is_ip_address(123) with pytest.raises(TypeError): helpers.is_ip_address(object())