- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for modelMap (0.09 sec)
-
tests/test_filter_pydantic_sub_model/test_filter_pydantic_sub_model_pv1.py
client = TestClient(app) return client @needs_pydanticv1 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", "model_b": {"username": "test-user"}, } @needs_pydanticv1
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 4.5K bytes - Viewed (0) -
tests/test_filter_pydantic_sub_model_pv2.py
@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} client = TestClient(app) return client @needs_pydanticv2 def test_filter_sub_model(client: TestClient): response = client.get("/model/modelA") assert response.status_code == 200, response.text
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 6.3K bytes - Viewed (0) -
tests/test_filter_pydantic_sub_model/app_pv1.py
from fastapi import Depends, FastAPI from pydantic import BaseModel, validator app = FastAPI() class ModelB(BaseModel): username: str class ModelC(ModelB): password: str class ModelA(BaseModel): name: str description: Optional[str] = None model_b: ModelB @validator("name") def lower_username(cls, name: str, values): if not name.endswith("A"):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 784 bytes - Viewed (0)