- Sort Score
- Result 10 results
- Languages All
Results 51 - 60 of 2,056 for app (0.03 sec)
-
tests/test_generic_parameterless_depends.py
from typing_extensions import Annotated app = FastAPI() T = TypeVar("T") Dep = Annotated[T, Depends()] class A: pass class B: pass @app.get("/a") async def a(dep: Dep[A]): return {"cls": dep.__class__.__name__} @app.get("/b") async def b(dep: Dep[B]): return {"cls": dep.__class__.__name__} client = TestClient(app)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Apr 02 02:52:56 UTC 2024 - 1.8K bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial003.py
from fastapi.testclient import TestClient from docs_src.request_files.tutorial003 import app client = TestClient(app) def test_post_files(tmp_path): path = tmp_path / "test.txt" path.write_bytes(b"<file content>") path2 = tmp_path / "test2.txt" path2.write_bytes(b"<file content2>") client = TestClient(app) with path.open("rb") as file, path2.open("rb") as file2: response = client.post(
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 7.1K bytes - Viewed (0) -
tests/test_response_model_invalid.py
def test_invalid_response_model_raises(): with pytest.raises(FastAPIError): app = FastAPI() @app.get("/", response_model=NonPydanticModel) def read_root(): pass # pragma: nocover def test_invalid_response_model_sub_type_raises(): with pytest.raises(FastAPIError): app = FastAPI() @app.get("/", response_model=List[NonPydanticModel]) def read_root():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Feb 29 13:04:35 UTC 2020 - 1.1K bytes - Viewed (0) -
tests/test_response_class_no_mediatype.py
from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() class JsonApiResponse(JSONResponse): media_type = "application/vnd.api+json" class Error(BaseModel): status: str title: str class JsonApiError(BaseModel): errors: typing.List[Error] @app.get( "/a", response_class=Response,
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 3.3K bytes - Viewed (0) -
tests/test_response_code_no_body.py
from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() class JsonApiResponse(JSONResponse): media_type = "application/vnd.api+json" class Error(BaseModel): status: str title: str class JsonApiError(BaseModel): errors: typing.List[Error] @app.get( "/a", status_code=204, response_class=JsonApiResponse,
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 3.2K bytes - Viewed (0) -
tests/test_starlette_urlconvertors.py
from fastapi.testclient import TestClient app = FastAPI() @app.get("/int/{param:int}") def int_convertor(param: int = Path()): return {"int": param} @app.get("/float/{param:float}") def float_convertor(param: float = Path()): return {"float": param} @app.get("/path/{param:path}") def path_convertor(param: str = Path()): return {"path": param} @app.get("/query/")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Nov 27 14:46:06 UTC 2022 - 1.7K bytes - Viewed (0) -
tests/test_tutorial/test_events/test_tutorial002.py
import pytest from fastapi import FastAPI from fastapi.testclient import TestClient @pytest.fixture(name="app", scope="module") def get_app(): with pytest.warns(DeprecationWarning): from docs_src.events.tutorial002 import app yield app def test_events(app: FastAPI): with TestClient(app) as client: response = client.get("/items/") assert response.status_code == 200, response.text
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 18 12:36:40 UTC 2023 - 1.4K bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial001.py
from dirty_equals import IsDict from fastapi.testclient import TestClient from docs_src.request_files.tutorial001 import app client = TestClient(app) file_required = { "detail": [ { "loc": ["body", "file"], "msg": "field required", "type": "value_error.missing", } ] } def test_post_form_no_body(): response = client.post("/files/")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 7.7K bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial001_an.py
from dirty_equals import IsDict from fastapi.testclient import TestClient from docs_src.request_files.tutorial001_an import app client = TestClient(app) def test_post_form_no_body(): response = client.post("/files/") assert response.status_code == 422, response.text assert response.json() == IsDict( { "detail": [ { "type": "missing",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 7.5K bytes - Viewed (0) -
tests/test_tutorial/test_cookie_params/test_tutorial001_an_py39.py
from docs_src.cookie_params.tutorial001_an_py39 import app client = TestClient(app, cookies=cookies) response = client.get(path) assert response.status_code == expected_status assert response.json() == expected_response @needs_py39 def test_openapi_schema(): from docs_src.cookie_params.tutorial001_an_py39 import app client = TestClient(app) response = client.get("/openapi.json")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 4.1K bytes - Viewed (0)