MCPcopy Index your code
hub / github.com/python-websockets/websockets / test_existing_socket

Method test_existing_socket

tests/asyncio/test_client.py:74–80  ·  view source on GitHub ↗

Client connects using a pre-existing socket.

(self)

Source from the content-addressed store, hash-verified

72 self.assertEqual(client.protocol.state.name, "OPEN")
73
74 async def test_existing_socket(self):
75 """Client connects using a pre-existing socket."""
76 async with serve(*args) as server:
77 with socket.create_connection(get_host_port(server)) as sock:
78 # Use a non-existing domain to ensure we connect to sock.
79 async with connect("ws://invalid/", sock=sock) as client:
80 self.assertEqual(client.protocol.state.name, "OPEN")
81
82 async def test_compression_is_enabled(self):
83 """Client enables compression by default."""

Callers

nothing calls this directly

Calls 4

serveFunction · 0.90
get_host_portFunction · 0.85
connectFunction · 0.50
create_connectionMethod · 0.45

Tested by

no test coverage detected