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
def test_netloc_format_without_port(): assert str(NetLoc("127.0.0.1")) == "127.0.0.1"
def test_netloc_str_should_brace_ipv6_addresses(): assert "[::1]:80" == str(NetLoc("::1", 80))
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"))
def test_netloc_format_without_port(): assert str(NetLoc('127.0.0.1')) == '127.0.0.1'
def test_netloc_str_should_brace_ipv6_addresses(): assert '[::1]:80' == str(NetLoc('::1', 80))