예제 #1
0
def test_invalid_address_to_host_port():
    """
    Test conversion of a wrong type to its corresponding host+port tuple.
    This conversion should cause an exception raising.
    """
    with pytest.raises(ValueError):
        address_to_host_port(1.234)
예제 #2
0
def test_invalid_address_to_host_port():
    """
    Test conversion of a wrong type to its corresponding host+port tuple.
    This conversion should cause an exception raising.
    """
    with pytest.raises(ValueError):
        address_to_host_port(1.234)
예제 #3
0
def test_valid_address_to_host_port(address, host, port):
    """
    Test conversion of an address to its corresponding host+port tuple.
    """
    assert address_to_host_port(address) == (host, port)
예제 #4
0
def test_agent_address_to_host_port():
    """
    An agent address should be convertible to host+port if TCP is used.
    """
    address = AgentAddress('tcp', '127.0.0.1:1234', 'PUSH', 'server', 'pickle')
    assert address_to_host_port(address) == ('127.0.0.1', 1234)
예제 #5
0
def test_valid_address_to_host_port(address, host, port):
    """
    Test conversion of an address to its corresponding host+port tuple.
    """
    assert address_to_host_port(address) == (host, port)
예제 #6
0
def test_agent_address_to_host_port():
    """
    An agent address should be convertible to host+port if TCP is used.
    """
    address = AgentAddress('tcp', '127.0.0.1:1234', 'PUSH', 'server', 'pickle')
    assert address_to_host_port(address) == ('127.0.0.1', 1234)