- Sort Score
- Result 10 results
- Languages All
Results 401 - 410 of 1,058 for Fstr (0.02 sec)
-
docs_src/schema_extra_example/tutorial003_an_py39.py
from typing import Annotated, Union from fastapi import Body, FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: Union[float, None] = None @app.put("/items/{item_id}") async def update_item( item_id: int, item: Annotated[ Item, Body( examples=[ {
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 692 bytes - Viewed (0) -
tests/test_union_body_discriminator.py
Field(discriminator="value"), ] @app.post("/items/") def save_union_body_discriminator( item: Item, q: Annotated[str, Field(description="Query string")] ) -> dict[str, Any]: return {"item": item} client = TestClient(app) response = client.post("/items/?q=first", json={"value": "first", "price": 100})
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 7.1K bytes - Viewed (0) -
tests/test_tutorial/test_body/test_tutorial002.py
client = TestClient(mod.app) return client @pytest.mark.parametrize("price", ["50.5", 50.5]) def test_post_with_tax(client: TestClient, price: Union[str, float]): response = client.post( "/items/", json={"name": "Foo", "price": price, "description": "Some Foo", "tax": 0.3}, ) assert response.status_code == 200 assert response.json() == {Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 5.3K bytes - Viewed (0) -
tests/test_openapi_separate_input_output_schemas.py
from pydantic import BaseModel, computed_field class SubItem(BaseModel): subname: str sub_description: Optional[str] = None tags: list[str] = [] model_config = {"json_schema_serialization_defaults_required": True} class Item(BaseModel): name: str description: Optional[str] = None sub: Optional[SubItem] = None model_config = {"json_schema_serialization_defaults_required": True}
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 26.6K bytes - Viewed (0) -
docs_src/body_fields/tutorial001_py310.py
from fastapi import Body, FastAPI from pydantic import BaseModel, Field app = FastAPI() class Item(BaseModel): name: str description: str | None = Field( default=None, title="The description of the item", max_length=300 ) price: float = Field(gt=0, description="The price must be greater than zero") tax: float | None = None @app.put("/items/{item_id}")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri May 13 23:38:22 UTC 2022 - 523 bytes - Viewed (0) -
docs_src/dependencies/tutorial006_py39.py
from fastapi import Depends, FastAPI, Header, HTTPException app = FastAPI() async def verify_token(x_token: str = Header()): if x_token != "fake-super-secret-token": raise HTTPException(status_code=400, detail="X-Token header invalid") async def verify_key(x_key: str = Header()): if x_key != "fake-super-secret-key": raise HTTPException(status_code=400, detail="X-Key header invalid") return x_key
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 583 bytes - Viewed (0) -
docs_src/handling_errors/tutorial003_py39.py
from fastapi import FastAPI, Request from fastapi.responses import JSONResponse class UnicornException(Exception): def __init__(self, name: str): self.name = name app = FastAPI() @app.exception_handler(UnicornException) async def unicorn_exception_handler(request: Request, exc: UnicornException): return JSONResponse( status_code=418,
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 626 bytes - Viewed (0) -
src/test/java/jcifs/internal/smb1/com/SmbComNTCreateAndXTest.java
SmbComNTCreateAndX req = createRequest(0, 0); String str = req.toString(); assertTrue(str.startsWith("SmbComNTCreateAndX["), "toString should start with class name"); assertTrue(str.contains("name=test.txt"), "The file name should appear"); // securityFlags are set to 0x03 – verify hex sequence assertTrue(str.contains("securityFlags=0x03"), "securityFlags should be present"); }
Registered: Sat Dec 20 13:44:44 UTC 2025 - Last Modified: Thu Aug 14 05:31:44 UTC 2025 - 5.6K bytes - Viewed (0) -
tests/test_tutorial/test_settings/test_app02.py
return mod_path @pytest.fixture(name="main_mod") def get_main_mod(mod_path: str) -> ModuleType: main_mod = importlib.import_module(f"{mod_path}.main") return main_mod @pytest.fixture(name="test_main_mod") def get_test_main_mod(mod_path: str) -> ModuleType: test_main_mod = importlib.import_module(f"{mod_path}.test_main") return test_main_mod
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 1K bytes - Viewed (0) -
docs_src/schema_extra_example/tutorial004_an_py39.py
from typing import Annotated, Union from fastapi import Body, FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: Union[float, None] = None @app.put("/items/{item_id}") async def update_item( *, item_id: int, item: Annotated[ Item, Body( examples=[
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Jul 01 16:43:29 UTC 2023 - 936 bytes - Viewed (0)