test_custom_route_class.py — fastapi Source File
Architecture documentation for test_custom_route_class.py, a python file in the fastapi codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 03b8225c_2e46_e60d_3266_63591da5f758["test_custom_route_class.py"] 5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"] 03b8225c_2e46_e60d_3266_63591da5f758 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9 534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"] 03b8225c_2e46_e60d_3266_63591da5f758 --> 534f6e44_61b8_3c38_8b89_6934a6df9802 de395a51_26f8_3424_1af0_2f5bef39c893["routing.py"] 03b8225c_2e46_e60d_3266_63591da5f758 --> de395a51_26f8_3424_1af0_2f5bef39c893 aa28685f_bb97_e988_ff40_3e5385960f32["APIRoute"] 03b8225c_2e46_e60d_3266_63591da5f758 --> aa28685f_bb97_e988_ff40_3e5385960f32 a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"] 03b8225c_2e46_e60d_3266_63591da5f758 --> a7c04dee_ee23_5891_b185_47ff6bed036d a7f4e7b0_9725_db90_5cbc_7ca8211b323a["inline_snapshot"] 03b8225c_2e46_e60d_3266_63591da5f758 --> a7f4e7b0_9725_db90_5cbc_7ca8211b323a b402dbc4_0006_47eb_6910_c438d002d7ae["starlette.routing"] 03b8225c_2e46_e60d_3266_63591da5f758 --> b402dbc4_0006_47eb_6910_c438d002d7ae style 03b8225c_2e46_e60d_3266_63591da5f758 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import pytest
from fastapi import APIRouter, FastAPI
from fastapi.routing import APIRoute
from fastapi.testclient import TestClient
from inline_snapshot import snapshot
from starlette.routing import Route
app = FastAPI()
class APIRouteA(APIRoute):
x_type = "A"
class APIRouteB(APIRoute):
x_type = "B"
class APIRouteC(APIRoute):
x_type = "C"
router_a = APIRouter(route_class=APIRouteA)
router_b = APIRouter(route_class=APIRouteB)
router_c = APIRouter(route_class=APIRouteC)
@router_a.get("/")
def get_a():
return {"msg": "A"}
@router_b.get("/")
def get_b():
return {"msg": "B"}
@router_c.get("/")
def get_c():
return {"msg": "C"}
router_b.include_router(router=router_c, prefix="/c")
router_a.include_router(router=router_b, prefix="/b")
app.include_router(router=router_a, prefix="/a")
client = TestClient(app)
@pytest.mark.parametrize(
"path,expected_status,expected_response",
[
("/a", 200, {"msg": "A"}),
("/a/b", 200, {"msg": "B"}),
("/a/b/c", 200, {"msg": "C"}),
],
)
def test_get_path(path, expected_status, expected_response):
response = client.get(path)
// ... (62 more lines)
Domain
Subdomains
Dependencies
- APIRoute
- __init__.py
- inline_snapshot
- pytest
- routing.py
- starlette.routing
- testclient.py
Source
Frequently Asked Questions
What does test_custom_route_class.py do?
test_custom_route_class.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_custom_route_class.py?
test_custom_route_class.py defines 6 function(s): get_a, get_b, get_c, test_get_path, test_openapi_schema, test_route_classes.
What does test_custom_route_class.py depend on?
test_custom_route_class.py imports 7 module(s): APIRoute, __init__.py, inline_snapshot, pytest, routing.py, starlette.routing, testclient.py.
Where is test_custom_route_class.py in the architecture?
test_custom_route_class.py is located at tests/test_custom_route_class.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