- Sort Score
- Result 10 results
- Languages All
Results 221 - 230 of 346 for BaseModel (0.04 sec)
-
tests/test_schema_compat_pydantic_v2.py
from inline_snapshot import snapshot from pydantic import BaseModel from tests.utils import needs_py310 @pytest.fixture(name="client") def get_client(): from enum import Enum app = FastAPI() class PlatformRole(str, Enum): admin = "admin" user = "user" class OtherRole(str, Enum): ... class User(BaseModel): username: str role: PlatformRole | OtherRole
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 2.7K bytes - Viewed (0) -
tests/test_no_schema_split.py
from pydantic import BaseModel, Field class MessageEventType(str, Enum): alpha = "alpha" beta = "beta" class MessageEvent(BaseModel): event_type: MessageEventType = Field(default=MessageEventType.alpha) output: str class MessageOutput(BaseModel): body: str = "" events: list[MessageEvent] = [] class Message(BaseModel): input: str
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 6.4K bytes - Viewed (0) -
tests/test_security_openid_connect.py
from fastapi import Depends, FastAPI, Security from fastapi.security.open_id_connect_url import OpenIdConnect from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() oid = OpenIdConnect(openIdConnectUrl="/openid") class User(BaseModel): username: str def get_current_user(oauth_header: str = Security(oid)): user = User(username=oauth_header) return user
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Nov 24 19:03:06 UTC 2025 - 2.3K bytes - Viewed (0) -
tests/test_inherited_custom_class.py
import uuid import pytest from fastapi import FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel class MyUuid: def __init__(self, uuid_string: str): self.uuid = uuid_string def __str__(self): return self.uuid @property # type: ignore def __class__(self): return uuid.UUID @property def __dict__(self):Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 12:54:56 UTC 2025 - 1.8K bytes - Viewed (0) -
tests/test_webhooks_security.py
from typing import Annotated from fastapi import FastAPI, Security from fastapi.security import HTTPBearer from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() bearer_scheme = HTTPBearer() class Subscription(BaseModel): username: str monthly_fee: float start_date: datetime @app.webhooks.post("new-subscription") def new_subscription(
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 4.5K bytes - Viewed (0) -
tests/test_additional_properties.py
from fastapi import FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() class Items(BaseModel): items: dict[str, int] @app.post("/foo") def foo(items: Items): return items.items client = TestClient(app) def test_additional_properties_post(): response = client.post("/foo", json={"items": {"foo": 1, "bar": 2}})
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 3.6K bytes - Viewed (0) -
tests/test_security_openid_connect_description.py
from fastapi.security.open_id_connect_url import OpenIdConnect from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() oid = OpenIdConnect( openIdConnectUrl="/openid", description="OpenIdConnect security scheme" ) class User(BaseModel): username: str def get_current_user(oauth_header: str = Security(oid)): user = User(username=oauth_header) return user
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Nov 24 19:03:06 UTC 2025 - 2.4K bytes - Viewed (0) -
fastapi/dependencies/utils.py
return True # If it's a Form (or File) field, it has to be a BaseModel (or a union of BaseModels) to be top level # otherwise it has to be embedded, so that the key value pair can be extracted if ( isinstance(first_field.field_info, params.Form) and not lenient_issubclass(first_field.type_, BaseModel) and not is_union_of_base_models(first_field.type_) ): return TrueRegistered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 12:54:56 UTC 2025 - 37.6K bytes - Viewed (3) -
tests/test_tuples.py
from fastapi import FastAPI, Form from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() class ItemGroup(BaseModel): items: list[tuple[str, str]] class Coordinate(BaseModel): x: float y: float @app.post("/model-with-tuple/") def post_model_with_tuple(item_group: ItemGroup): return item_group @app.post("/tuple-of-models/")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 9.8K bytes - Viewed (0) -
docs_src/python_types/tutorial012_py39.py
from typing import Optional from pydantic import BaseModel class User(BaseModel): name: str
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 122 bytes - Viewed (0)