- Sort Score
- Result 10 results
- Languages All
Results 41 - 50 of 780 for fdef (0.75 sec)
-
docs_src/websockets/tutorial003_py39.py
</html> """ class ConnectionManager: def __init__(self): self.active_connections: list[WebSocket] = [] async def connect(self, websocket: WebSocket): await websocket.accept() self.active_connections.append(websocket) def disconnect(self, websocket: WebSocket): self.active_connections.remove(websocket) async def send_personal_message(self, message: str, websocket: WebSocket):Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 2.5K bytes - Viewed (0) -
tests/test_request_params/test_body/test_optional_list.py
@app.post("/optional-list-str", operation_id="optional_list_str") async def read_optional_list_str( p: Annotated[Optional[list[str]], Body(embed=True)] = None, ): return {"p": p} class BodyModelOptionalListStr(BaseModel): p: Optional[list[str]] = None @app.post("/model-optional-list-str", operation_id="model_optional_list_str") async def read_model_optional_list_str(p: BodyModelOptionalListStr): return {"p": p.p}
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 12.7K bytes - Viewed (0) -
tests/test_dependency_yield_scope_websockets.py
from fastapi.testclient import TestClient global_context: ContextVar[dict[str, Any]] = ContextVar("global_context", default={}) # noqa: B039 class Session: def __init__(self) -> None: self.open = True async def dep_session() -> Any: s = Session() yield s s.open = False global_state = global_context.get() global_state["session_closed"] = True
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 6K bytes - Viewed (0) -
tests/test_request_params/test_header/test_optional_str.py
# Without aliases @app.get("/optional-str") async def read_optional_str(p: Annotated[Optional[str], Header()] = None): return {"p": p} class HeaderModelOptionalStr(BaseModel): p: Optional[str] = None @app.get("/model-optional-str") async def read_model_optional_str(p: Annotated[HeaderModelOptionalStr, Header()]): return {"p": p.p}
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 8.2K bytes - Viewed (0) -
tests/test_request_params/test_header/test_required_str.py
# Without aliases @app.get("/required-str") async def read_required_str(p: Annotated[str, Header()]): return {"p": p} class HeaderModelRequiredStr(BaseModel): p: str @app.get("/model-required-str") async def read_model_required_str(p: Annotated[HeaderModelRequiredStr, Header()]): return {"p": p.p} @pytest.mark.parametrize(
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 10K bytes - Viewed (0) -
tests/test_serialize_response_model.py
owner_ids: Optional[list[int]] = None @app.get("/items/valid", response_model=Item) def get_valid(): return Item(aliased_name="valid", price=1.0) @app.get("/items/coerce", response_model=Item) def get_coerce(): return Item(aliased_name="coerce", price="1.0") @app.get("/items/validlist", response_model=list[Item]) def get_validlist(): return [ Item(aliased_name="foo"),
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 4.2K bytes - Viewed (0) -
tests/test_datastructures.py
from fastapi.testclient import TestClient def test_upload_file_invalid_pydantic_v2(): with pytest.raises(ValueError): UploadFile._validate("not a Starlette UploadFile", {}) def test_default_placeholder_equals(): placeholder_1 = Default("a") placeholder_2 = Default("a") assert placeholder_1 == placeholder_2 assert placeholder_1.value == placeholder_2.value def test_default_placeholder_bool():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 1.8K bytes - Viewed (0) -
tests/test_request_params/test_body/test_required_str.py
# Without aliases @app.post("/required-str", operation_id="required_str") async def read_required_str(p: Annotated[str, Body(embed=True)]): return {"p": p} class BodyModelRequiredStr(BaseModel): p: str @app.post("/model-required-str", operation_id="model_required_str") async def read_model_required_str(p: BodyModelRequiredStr): return {"p": p.p} @pytest.mark.parametrize(
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 11K bytes - Viewed (0) -
tests/test_request_params/test_file/test_optional_list.py
# Without aliases @app.post("/optional-list-bytes") async def read_optional_list_bytes(p: Annotated[Optional[list[bytes]], File()] = None): return {"file_size": [len(file) for file in p] if p else None} @app.post("/optional-list-uploadfile") async def read_optional_list_uploadfile( p: Annotated[Optional[list[UploadFile]], File()] = None, ):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 10.4K bytes - Viewed (0) -
tests/test_tutorial/test_metadata/test_tutorial003.py
} }, } def test_swagger_ui_default_url(): response = client.get("/docs") assert response.status_code == 404, response.text def test_swagger_ui_custom_url(): response = client.get("/documentation") assert response.status_code == 200, response.text assert "<title>FastAPI - Swagger UI</title>" in response.text def test_redoc_ui_default_url():Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 1.5K bytes - Viewed (0)