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

Method test_existing_socket

tests/sync/test_client.py:43–49  ·  view source on GitHub ↗

Client connects using a pre-existing socket.

(self)

Source from the content-addressed store, hash-verified

41 self.assertEqual(client.protocol.state.name, "OPEN")
42
43 def test_existing_socket(self):
44 """Client connects using a pre-existing socket."""
45 with run_server() as server:
46 with socket.create_connection(server.socket.getsockname()) as sock:
47 # Use a non-existing domain to ensure we connect to sock.
48 with connect("ws://invalid/", sock=sock) as client:
49 self.assertEqual(client.protocol.state.name, "OPEN")
50
51 def test_compression_is_enabled(self):
52 """Client enables compression by default."""

Callers

nothing calls this directly

Calls 3

run_serverFunction · 0.85
connectFunction · 0.50
create_connectionMethod · 0.45

Tested by

no test coverage detected