- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 373 for testclient (0.04 sec)
-
tests/test_tutorial/test_body/test_tutorial001.py
import importlib from unittest.mock import patch import pytest from fastapi.testclient import TestClient from ...utils import needs_py310 @pytest.fixture( name="client", params=[ "tutorial001_py39", pytest.param("tutorial001_py310", marks=needs_py310), ], ) def get_client(request: pytest.FixtureRequest): mod = importlib.import_module(f"docs_src.body.{request.param}")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 10.6K bytes - Viewed (0) -
tests/test_tutorial/test_path_params_numeric_validations/test_tutorial005.py
import pytest from fastapi.testclient import TestClient @pytest.fixture( name="client", params=[ pytest.param("tutorial005_py39"), pytest.param("tutorial005_an_py39"), ], ) def get_client(request: pytest.FixtureRequest) -> TestClient: mod = importlib.import_module( f"docs_src.path_params_numeric_validations.{request.param}" ) return TestClient(mod.app)
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 6.6K bytes - Viewed (0) -
tests/test_tutorial/test_query_params_str_validations/test_tutorial003.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_query(client: TestClient):Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 5.1K bytes - Viewed (0) -
tests/benchmarks/test_general_performance.py
): return ItemOut(name="foo", value=123, dep=dep) @pytest.fixture(scope="module") def client() -> Iterator[TestClient]: with TestClient(app) as client: yield client def _bench_get(benchmark, client: TestClient, path: str) -> tuple[int, bytes]: warmup = client.get(path) assert warmup.status_code == 200 def do_request() -> tuple[int, bytes]:Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 20:40:26 UTC 2025 - 11.1K bytes - Viewed (0) -
tests/test_request_params/test_cookie/test_optional_str.py
from typing import Annotated, Optional import pytest from fastapi import Cookie, FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel, Field app = FastAPI() # ===================================================================================== # Without aliases @app.get("/optional-str") async def read_optional_str(p: Annotated[Optional[str], Cookie()] = None): return {"p": p}
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 8.4K bytes - Viewed (0) -
tests/test_tutorial/test_dependencies/test_tutorial008c.py
import importlib from types import ModuleType import pytest from fastapi.exceptions import FastAPIError from fastapi.testclient import TestClient @pytest.fixture( name="mod", params=[ pytest.param("tutorial008c_py39"), pytest.param("tutorial008c_an_py39"), ], ) def get_mod(request: pytest.FixtureRequest): mod = importlib.import_module(f"docs_src.dependencies.{request.param}") return mod
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 1.4K bytes - Viewed (0) -
tests/test_request_params/test_header/test_optional_list.py
from typing import Annotated, Optional import pytest from fastapi import FastAPI, Header from fastapi.testclient import TestClient from pydantic import BaseModel, Field app = FastAPI() # ===================================================================================== # Without aliases @app.get("/optional-list-str") async def read_optional_list_str( p: Annotated[Optional[list[str]], Header()] = None, ):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 9.3K bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial001_02.py
client = TestClient(mod.app) return client def test_post_form_no_body(client: TestClient): response = client.post("/files/") assert response.status_code == 200, response.text assert response.json() == {"message": "No file sent"} def test_post_uploadfile_no_body(client: TestClient): response = client.post("/uploadfile/")Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 7.4K bytes - Viewed (0) -
tests/test_tutorial/test_custom_request_and_route/test_tutorial002.py
mod = importlib.import_module(f"docs_src.custom_request_and_route.{request.param}") client = TestClient(mod.app) return client def test_endpoint_works(client: TestClient): response = client.post("/", json=[1, 2, 3]) assert response.json() == 6 def test_exception_handler_body_access(client: TestClient): response = client.post("/", json={"numbers": [1, 2, 3]}) assert response.json() == {
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 1.3K bytes - Viewed (0) -
tests/test_tutorial/test_response_directly/test_tutorial002.py
import pytest from fastapi.testclient import TestClient @pytest.fixture( name="client", params=[ pytest.param("tutorial002_py39"), ], ) def get_client(request: pytest.FixtureRequest): mod = importlib.import_module(f"docs_src.response_directly.{request.param}") client = TestClient(mod.app) return client def test_path_operation(client: TestClient):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 1.7K bytes - Viewed (0)