예제 #1
0
def test_parse_network_address_defaults_to_inaddr_any():
    actual = parse.network_address(u':8080')
    assert actual == ((u'0.0.0.0', 8080), socket.AF_INET), actual
예제 #2
0
def test_parse_network_address_notices_ipv6():
    actual = parse.network_address(u"2607:f0d0:1002:51::4")
    assert actual == (u"2607:f0d0:1002:51::4", socket.AF_INET6), actual
예제 #3
0
def test_parse_network_address_sees_one_colon_as_ipv4():
    actual = parse.network_address(u"192.168.1.1:8080")
    assert actual == ((u"192.168.1.1", 8080), socket.AF_INET), actual
예제 #4
0
def test_address_can_be_localhost():
    expected = (('127.0.0.1', 8000), 2)
    actual = parse.network_address(u'localhost:8000')
    assert actual == expected, actual
예제 #5
0
def test_parse_network_address_unix_socket():
    actual = parse.network_address(u"/foo/bar")
    assert actual == ("/foo/bar", socket.AF_UNIX), actual
예제 #6
0
def test_parse_network_address_defaults_to_inaddr_any():
    actual = parse.network_address(u':8080')
    assert actual == ((u'0.0.0.0', 8080), socket.AF_INET)
예제 #7
0
def test_parse_network_address_sees_one_colon_as_ipv4():
    actual = parse.network_address(u"192.168.1.1:8080")
    assert actual == ((u"192.168.1.1", 8080), socket.AF_INET)
예제 #8
0
def test_parse_network_address_notices_ipv6():
    actual = parse.network_address(u"2607:f0d0:1002:51::4")
    assert actual == (u"2607:f0d0:1002:51::4", socket.AF_INET6)
예제 #9
0
def test_parse_network_address_unix_socket():
    actual = parse.network_address(u"/foo/bar")
    assert actual == ("/foo/bar", socket.AF_UNIX)
예제 #10
0
def test_address_can_be_localhost():
    expected = (('127.0.0.1', 8000), 2)
    actual = parse.network_address(u'localhost:8000')
    assert actual == expected