Home / File/ test_ws_router.py — fastapi Source File

test_ws_router.py — fastapi Source File

Architecture documentation for test_ws_router.py, a python file in the fastapi codebase. 5 imports, 0 dependents.

File python FastAPI Routing 5 imports 27 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  b2e4c2fb_8042_93dc_9d79_2ae1a12773d6["test_ws_router.py"]
  958aa7af_9d63_fe0c_3544_91dd93294508["functools"]
  b2e4c2fb_8042_93dc_9d79_2ae1a12773d6 --> 958aa7af_9d63_fe0c_3544_91dd93294508
  5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"]
  b2e4c2fb_8042_93dc_9d79_2ae1a12773d6 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  b2e4c2fb_8042_93dc_9d79_2ae1a12773d6 --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  4ee2fe33_75fe_2354_b7f7_56188a628ce9["__init__.py"]
  b2e4c2fb_8042_93dc_9d79_2ae1a12773d6 --> 4ee2fe33_75fe_2354_b7f7_56188a628ce9
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  b2e4c2fb_8042_93dc_9d79_2ae1a12773d6 --> a7c04dee_ee23_5891_b185_47ff6bed036d
  style b2e4c2fb_8042_93dc_9d79_2ae1a12773d6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import functools

import pytest
from fastapi import (
    APIRouter,
    Depends,
    FastAPI,
    Header,
    WebSocket,
    WebSocketDisconnect,
    status,
)
from fastapi.middleware import Middleware
from fastapi.testclient import TestClient

router = APIRouter()
prefix_router = APIRouter()
native_prefix_route = APIRouter(prefix="/native")
app = FastAPI()


@app.websocket_route("/")
async def index(websocket: WebSocket):
    await websocket.accept()
    await websocket.send_text("Hello, world!")
    await websocket.close()


@router.websocket_route("/router")
async def routerindex(websocket: WebSocket):
    await websocket.accept()
    await websocket.send_text("Hello, router!")
    await websocket.close()


@prefix_router.websocket_route("/")
async def routerprefixindex(websocket: WebSocket):
    await websocket.accept()
    await websocket.send_text("Hello, router with prefix!")
    await websocket.close()


@router.websocket("/router2")
async def routerindex2(websocket: WebSocket):
    await websocket.accept()
    await websocket.send_text("Hello, router!")
    await websocket.close()


@router.websocket("/router/{pathparam:path}")
async def routerindexparams(websocket: WebSocket, pathparam: str, queryparam: str):
    await websocket.accept()
    await websocket.send_text(pathparam)
    await websocket.send_text(queryparam)
    await websocket.close()


async def ws_dependency():
    return "Socket Dependency"

// ... (212 more lines)

Domain

Subdomains

Classes

Dependencies

Frequently Asked Questions

What does test_ws_router.py do?
test_ws_router.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Routing subdomain.
What functions are defined in test_ws_router.py?
test_ws_router.py defines 27 function(s): index, make_app, router_native_prefix_ws, router_ws_custom_error, router_ws_decorator_depends, router_ws_depends_err, router_ws_depends_validate, routerindex, routerindex2, routerindexparams, and 17 more.
What does test_ws_router.py depend on?
test_ws_router.py imports 5 module(s): __init__.py, __init__.py, functools, pytest, testclient.py.
Where is test_ws_router.py in the architecture?
test_ws_router.py is located at tests/test_ws_router.py (domain: FastAPI, subdomain: Routing, directory: tests).

Analyze Your Own Codebase

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

Try Supermodel Free