Home / Function/ test_websocket_handle_disconnection() — fastapi Function Reference

test_websocket_handle_disconnection() — fastapi Function Reference

Architecture documentation for the test_websocket_handle_disconnection() function in test_tutorial003.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  0bee5527_1064_e45c_e36f_652614874827["test_websocket_handle_disconnection()"]
  da2d3095_b57b_ccf6_1a5b_348ba40f3b50["test_tutorial003.py"]
  0bee5527_1064_e45c_e36f_652614874827 -->|defined in| da2d3095_b57b_ccf6_1a5b_348ba40f3b50
  style 0bee5527_1064_e45c_e36f_652614874827 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_tutorial/test_websockets/test_tutorial003.py lines 37–52

def test_websocket_handle_disconnection(client: TestClient):
    with (
        client.websocket_connect("/ws/1234") as connection,
        client.websocket_connect("/ws/5678") as connection_two,
    ):
        connection.send_text("Hello from 1234")
        data1 = connection.receive_text()
        assert data1 == "You wrote: Hello from 1234"
        data2 = connection_two.receive_text()
        client1_says = "Client #1234 says: Hello from 1234"
        assert data2 == client1_says
        data1 = connection.receive_text()
        assert data1 == client1_says
        connection_two.close()
        data1 = connection.receive_text()
        assert data1 == "Client #5678 left the chat"

Domain

Subdomains

Frequently Asked Questions

What does test_websocket_handle_disconnection() do?
test_websocket_handle_disconnection() is a function in the fastapi codebase, defined in tests/test_tutorial/test_websockets/test_tutorial003.py.
Where is test_websocket_handle_disconnection() defined?
test_websocket_handle_disconnection() is defined in tests/test_tutorial/test_websockets/test_tutorial003.py at line 37.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free