MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_address

Method test_address

Lib/test/test_socket.py:7256–7265  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

7254class CreateServerTest(unittest.TestCase):
7255
7256 def test_address(self):
7257 port = socket_helper.find_unused_port()
7258 with socket.create_server(("127.0.0.1", port)) as sock:
7259 self.assertEqual(sock.getsockname()[0], "127.0.0.1")
7260 self.assertEqual(sock.getsockname()[1], port)
7261 if socket_helper.IPV6_ENABLED:
7262 with socket.create_server(("::1", port),
7263 family=socket.AF_INET6) as sock:
7264 self.assertEqual(sock.getsockname()[0], "::1")
7265 self.assertEqual(sock.getsockname()[1], port)
7266
7267 def test_family_and_type(self):
7268 with socket.create_server(("127.0.0.1", 0)) as sock:

Callers

nothing calls this directly

Calls 3

create_serverMethod · 0.45
assertEqualMethod · 0.45
getsocknameMethod · 0.45

Tested by

no test coverage detected