MCPcopy Index your code
hub / github.com/python/cpython / test_address

Method test_address

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

Source from the content-addressed store, hash-verified

7344class CreateServerTest(unittest.TestCase):
7345
7346 def test_address(self):
7347 port = socket_helper.find_unused_port()
7348 with socket.create_server(("127.0.0.1", port)) as sock:
7349 self.assertEqual(sock.getsockname()[0], "127.0.0.1")
7350 self.assertEqual(sock.getsockname()[1], port)
7351 if socket_helper.IPV6_ENABLED:
7352 with socket.create_server(("::1", port),
7353 family=socket.AF_INET6) as sock:
7354 self.assertEqual(sock.getsockname()[0], "::1")
7355 self.assertEqual(sock.getsockname()[1], port)
7356
7357 def test_family_and_type(self):
7358 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