test_filter_pydantic_sub_model_pv2.py — fastapi Source File
Architecture documentation for test_filter_pydantic_sub_model_pv2.py, a python file in the fastapi codebase. 9 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 2927101d_fb92_c1c6_6e38_9ecdc5507a94["test_filter_pydantic_sub_model_pv2.py"] 0dda2280_3359_8460_301c_e98c77e78185["typing"] 2927101d_fb92_c1c6_6e38_9ecdc5507a94 --> 0dda2280_3359_8460_301c_e98c77e78185 5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"] 2927101d_fb92_c1c6_6e38_9ecdc5507a94 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9 752ca3d8_e45b_84ed_d1a1_588cbc236b65["dirty_equals"] 2927101d_fb92_c1c6_6e38_9ecdc5507a94 --> 752ca3d8_e45b_84ed_d1a1_588cbc236b65 534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"] 2927101d_fb92_c1c6_6e38_9ecdc5507a94 --> 534f6e44_61b8_3c38_8b89_6934a6df9802 01c652c5_d85c_f45e_848e_412c94ea4172["exceptions.py"] 2927101d_fb92_c1c6_6e38_9ecdc5507a94 --> 01c652c5_d85c_f45e_848e_412c94ea4172 6c4918cc_63d7_a03d_91ee_e65fc35b0746["ResponseValidationError"] 2927101d_fb92_c1c6_6e38_9ecdc5507a94 --> 6c4918cc_63d7_a03d_91ee_e65fc35b0746 a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"] 2927101d_fb92_c1c6_6e38_9ecdc5507a94 --> a7c04dee_ee23_5891_b185_47ff6bed036d a7f4e7b0_9725_db90_5cbc_7ca8211b323a["inline_snapshot"] 2927101d_fb92_c1c6_6e38_9ecdc5507a94 --> a7f4e7b0_9725_db90_5cbc_7ca8211b323a 6913fbd4_39df_d14b_44bb_522e99b65b90["pydantic"] 2927101d_fb92_c1c6_6e38_9ecdc5507a94 --> 6913fbd4_39df_d14b_44bb_522e99b65b90 style 2927101d_fb92_c1c6_6e38_9ecdc5507a94 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from typing import Optional
import pytest
from dirty_equals import HasRepr
from fastapi import Depends, FastAPI
from fastapi.exceptions import ResponseValidationError
from fastapi.testclient import TestClient
from inline_snapshot import snapshot
@pytest.fixture(name="client")
def get_client():
from pydantic import BaseModel, ValidationInfo, field_validator
app = FastAPI()
class ModelB(BaseModel):
username: str
class ModelC(ModelB):
password: str
class ModelA(BaseModel):
name: str
description: Optional[str] = None
foo: ModelB
tags: dict[str, str] = {}
@field_validator("name")
def lower_username(cls, name: str, info: ValidationInfo):
if not name.endswith("A"):
raise ValueError("name must end in A")
return name
async def get_model_c() -> ModelC:
return ModelC(username="test-user", password="test-password")
@app.get("/model/{name}", response_model=ModelA)
async def get_model_a(name: str, model_c=Depends(get_model_c)):
return {
"name": name,
"description": "model-a-desc",
"foo": model_c,
"tags": {"key1": "value1", "key2": "value2"},
}
client = TestClient(app)
return client
def test_filter_sub_model(client: TestClient):
response = client.get("/model/modelA")
assert response.status_code == 200, response.text
assert response.json() == {
"name": "modelA",
"description": "model-a-desc",
"foo": {"username": "test-user"},
"tags": {"key1": "value1", "key2": "value2"},
}
// ... (125 more lines)
Domain
Subdomains
Dependencies
- ResponseValidationError
- __init__.py
- dirty_equals
- exceptions.py
- inline_snapshot
- pydantic
- pytest
- testclient.py
- typing
Source
Frequently Asked Questions
What does test_filter_pydantic_sub_model_pv2.py do?
test_filter_pydantic_sub_model_pv2.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Applications subdomain.
What functions are defined in test_filter_pydantic_sub_model_pv2.py?
test_filter_pydantic_sub_model_pv2.py defines 4 function(s): get_client, test_filter_sub_model, test_openapi_schema, test_validator_is_cloned.
What does test_filter_pydantic_sub_model_pv2.py depend on?
test_filter_pydantic_sub_model_pv2.py imports 9 module(s): ResponseValidationError, __init__.py, dirty_equals, exceptions.py, inline_snapshot, pydantic, pytest, testclient.py, and 1 more.
Where is test_filter_pydantic_sub_model_pv2.py in the architecture?
test_filter_pydantic_sub_model_pv2.py is located at tests/test_filter_pydantic_sub_model_pv2.py (domain: FastAPI, subdomain: Applications, directory: tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free