示例#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
示例#2
0
def test_netloc_format_without_port():
    assert str(NetLoc("127.0.0.1")) == "127.0.0.1"
示例#3
0
def test_netloc_str_should_brace_ipv6_addresses():
    assert "[::1]:80" == str(NetLoc("::1", 80))
示例#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"))
示例#5
0
def test_netloc_format_without_port():
    assert str(NetLoc('127.0.0.1')) == '127.0.0.1'
示例#6
0
def test_netloc_str_should_brace_ipv6_addresses():
    assert '[::1]:80' == str(NetLoc('::1', 80))