test_depend_validation() — fastapi Function Reference
Architecture documentation for the test_depend_validation() function in test_ws_router.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 9dd8d5e2_dc81_0024_ce18_a03f51e1055d["test_depend_validation()"] b2e4c2fb_8042_93dc_9d79_2ae1a12773d6["test_ws_router.py"] 9dd8d5e2_dc81_0024_ce18_a03f51e1055d -->|defined in| b2e4c2fb_8042_93dc_9d79_2ae1a12773d6 afb5e1a2_9bfc_75af_3be4_6639f67befbd["make_app()"] 9dd8d5e2_dc81_0024_ce18_a03f51e1055d -->|calls| afb5e1a2_9bfc_75af_3be4_6639f67befbd style 9dd8d5e2_dc81_0024_ce18_a03f51e1055d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_ws_router.py lines 210–233
def test_depend_validation():
"""
Verify that a validation in a dependency invokes the correct exception handler
"""
caught = []
@websocket_middleware
async def catcher(websocket, call_next):
try:
return await call_next()
except Exception as e: # pragma: no cover
caught.append(e)
raise
myapp = make_app(middleware=[Middleware(catcher)])
client = TestClient(myapp)
with pytest.raises(WebSocketDisconnect) as e:
with client.websocket_connect("/depends-validate/"):
pass # pragma: no cover
# the validation error does produce a close message
assert e.value.code == status.WS_1008_POLICY_VIOLATION
# and no error is leaked
assert caught == []
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does test_depend_validation() do?
test_depend_validation() is a function in the fastapi codebase, defined in tests/test_ws_router.py.
Where is test_depend_validation() defined?
test_depend_validation() is defined in tests/test_ws_router.py at line 210.
What does test_depend_validation() call?
test_depend_validation() calls 1 function(s): make_app.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free