def test_getHost_works_with_IPv6_address(self): port = Port(0, DummyProtocol(), "::1") port.addressFamily = AF_INET6 port.startListening() self.addCleanup(port.stopListening) self.assertEqual(IPv6Address("UDP", "::1", port._realPortNumber), port.getHost())
def test_getHost_works_with_IPv4_address(self): port = Port(0, DummyProtocol(), "127.0.0.1") port.addressFamily = AF_INET port.startListening() self.addCleanup(port.stopListening) self.assertEqual(IPv4Address('UDP', '127.0.0.1', port._realPortNumber), port.getHost())