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)
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)
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)