- Sort Score
- Result 10 results
- Languages All
Results 291 - 300 of 518 for testclient (0.05 sec)
-
tests/test_dependency_yield_scope.py
from typing import Annotated, Any import pytest from fastapi import APIRouter, Depends, FastAPI, HTTPException from fastapi.exceptions import FastAPIError from fastapi.responses import StreamingResponse from fastapi.testclient import TestClient class Session: def __init__(self) -> None: self.open = True def dep_session() -> Any: s = Session() yield s s.open = FalseRegistered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 6.7K bytes - Viewed (0) -
tests/test_openapi_servers.py
from fastapi import FastAPI from fastapi.testclient import TestClient from inline_snapshot import snapshot app = FastAPI( servers=[ {"url": "/", "description": "Default, relative server"}, { "url": "http://staging.localhost.tiangolo.com:8000", "description": "Staging but actually localhost still", }, {"url": "https://prod.example.com"}, ] ) @app.get("/foo")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 1.7K bytes - Viewed (0) -
tests/test_custom_schema_fields.py
from typing import Annotated, Optional from fastapi import FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel, WithJsonSchema app = FastAPI() class Item(BaseModel): name: str description: Annotated[ Optional[str], WithJsonSchema({"type": ["string", "null"]}) ] = None model_config = { "json_schema_extra": { "x-something-internal": {"level": 4},
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 1.3K bytes - Viewed (0) -
tests/test_validate_response_dataclass.py
from typing import Optional import pytest from fastapi import FastAPI from fastapi.exceptions import ResponseValidationError from fastapi.testclient import TestClient from pydantic.dataclasses import dataclass app = FastAPI() @dataclass class Item: name: str price: Optional[float] = None owner_ids: Optional[list[int]] = None @app.get("/items/invalid", response_model=Item) def get_invalid():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 1.2K bytes - Viewed (0) -
tests/test_tutorial/test_query_params_str_validations/test_tutorial015.py
) client = TestClient(mod.app) return client def test_get_random_item(client: TestClient): response = client.get("/items") assert response.status_code == 200, response.text assert response.json() == {"id": IsStr(), "name": IsStr()} def test_get_item(client: TestClient): response = client.get("/items?id=isbn-9781529046137")Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 5K bytes - Viewed (0) -
tests/test_request_params/test_query/test_optional_str.py
from typing import Annotated, Optional import pytest from fastapi import FastAPI, Query from fastapi.testclient import TestClient from pydantic import BaseModel, Field app = FastAPI() # ===================================================================================== # Without aliases @app.get("/optional-str") async def read_optional_str(p: Optional[str] = None): return {"p": p}
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 8.1K bytes - Viewed (0) -
tests/test_tutorial/test_settings/test_app03.py
import importlib from types import ModuleType import pytest from fastapi.testclient import TestClient from pytest import MonkeyPatch @pytest.fixture( name="mod_path", params=[ pytest.param("app03_py39"), pytest.param("app03_an_py39"), ], ) def get_mod_path(request: pytest.FixtureRequest): mod_path = f"docs_src.settings.{request.param}" return mod_path
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 12:54:56 UTC 2025 - 1.2K bytes - Viewed (0) -
tests/test_tutorial/test_query_params_str_validations/test_tutorial001.py
client = TestClient(mod.app) return client def test_query_params_str_validations_no_query(client: TestClient): response = client.get("/items/") assert response.status_code == 200 assert response.json() == {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]} def test_query_params_str_validations_q_empty_str(client: TestClient): response = client.get("/items/", params={"q": ""}) assert response.status_code == 200Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 4.1K bytes - Viewed (0) -
tests/test_tutorial/test_custom_response/test_tutorial002_tutorial003_tutorial004.py
import pytest from fastapi.testclient import TestClient @pytest.fixture( name="mod_name", params=[ pytest.param("tutorial002_py39"), pytest.param("tutorial003_py39"), pytest.param("tutorial004_py39"), ], ) def get_mod_name(request: pytest.FixtureRequest) -> str: return request.param @pytest.fixture(name="client") def get_client(mod_name: str) -> TestClient:
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 1.8K bytes - Viewed (0) -
tests/test_tutorial/test_body_multiple_params/test_tutorial005.py
import importlib import pytest from fastapi.testclient import TestClient from ...utils import needs_py310 @pytest.fixture( name="client", params=[ pytest.param("tutorial005_py39"), pytest.param("tutorial005_py310", marks=needs_py310), pytest.param("tutorial005_an_py39"), pytest.param("tutorial005_an_py310", marks=needs_py310), ], ) def get_client(request: pytest.FixtureRequest):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 8.2K bytes - Viewed (0)