Ejemplo n.º 1
0
def test_netloc_ordering():
    address1 = NetLoc("127.0.0.5")
    address2 = NetLoc("127.0.0.5", "80")
    address3 = NetLoc("asdf")
    address4 = NetLoc("asdf", "90")
    sorted_list = sorted([address3, address2, address4, address1])
    assert [address1, address2, address3, address4] == sorted_list
Ejemplo n.º 2
0
def test_netloc_format_without_port():
    assert str(NetLoc("127.0.0.1")) == "127.0.0.1"
Ejemplo n.º 3
0
def test_netloc_str_should_brace_ipv6_addresses():
    assert "[::1]:80" == str(NetLoc("::1", 80))
Ejemplo n.º 4
0
def test_netloc_repr():
    assert "<NetLoc `127.0.0.5:80`>" == repr(NetLoc("127.0.0.5", "80"))
    assert "<NetLoc `127.0.0.5`>" == repr(NetLoc("127.0.0.5"))
Ejemplo n.º 5
0
def test_netloc_format_without_port():
    assert str(NetLoc('127.0.0.1')) == '127.0.0.1'
Ejemplo n.º 6
0
def test_netloc_str_should_brace_ipv6_addresses():
    assert '[::1]:80' == str(NetLoc('::1', 80))