- Sort Score
- Result 10 results
- Languages All
Results 251 - 260 of 1,127 for def2 (0.02 sec)
-
docs_src/app_testing/app_b/test_main.py
from .main import app client = TestClient(app) def test_read_item(): response = client.get("/items/foo", headers={"X-Token": "coneofsilence"}) assert response.status_code == 200 assert response.json() == { "id": "foo", "title": "Foo", "description": "There goes my hero", } def test_read_item_bad_token():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Mar 13 19:07:10 UTC 2024 - 1.8K bytes - Viewed (0) -
docs_src/app_testing/app_b_an_py39/test_main.py
from .main import app client = TestClient(app) def test_read_item(): response = client.get("/items/foo", headers={"X-Token": "coneofsilence"}) assert response.status_code == 200 assert response.json() == { "id": "foo", "title": "Foo", "description": "There goes my hero", } def test_read_item_bad_token():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Aug 15 22:31:16 UTC 2024 - 1.8K bytes - Viewed (0) -
tests/test_additional_properties.py
items: Dict[str, int] @app.post("/foo") def foo(items: Items): return items.items client = TestClient(app) def test_additional_properties_post(): response = client.post("/foo", json={"items": {"foo": 1, "bar": 2}}) assert response.status_code == 200, response.text assert response.json() == {"foo": 1, "bar": 2} def test_openapi_schema(): response = client.get("/openapi.json")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 3.6K bytes - Viewed (0) -
tests/test_response_class_no_mediatype.py
response_class=Response, responses={500: {"description": "Error", "model": JsonApiError}}, ) async def a(): pass # pragma: no cover @app.get("/b", responses={500: {"description": "Error", "model": Error}}) async def b(): pass # pragma: no cover client = TestClient(app) def test_openapi_schema(): response = client.get("/openapi.json") assert response.status_code == 200, response.text
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_tutorial/test_query_params_str_validations/test_tutorial011.py
from docs_src.query_params_str_validations.tutorial011 import app client = TestClient(app) def test_multi_query_values(): url = "/items/?q=foo&q=bar" response = client.get(url) assert response.status_code == 200, response.text assert response.json() == {"q": ["foo", "bar"]} def test_query_no_values(): url = "/items/" response = client.get(url)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 3.9K bytes - Viewed (0) -
docs_src/dependencies/tutorial011.py
app = FastAPI() class FixedContentQueryChecker: def __init__(self, fixed_content: str): self.fixed_content = fixed_content def __call__(self, q: str = ""): if q: return self.fixed_content in q return False checker = FixedContentQueryChecker("bar") @app.get("/query-checker/") async def read_query_check(fixed_content_included: bool = Depends(checker)):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Mar 26 19:09:53 UTC 2020 - 504 bytes - Viewed (0) -
tests/test_tutorial/test_dependencies/test_tutorial012_an.py
}, ] } ) def test_get_invalid_one_header_items(): response = client.get("/items/", headers={"X-Token": "invalid"}) assert response.status_code == 400, response.text assert response.json() == {"detail": "X-Token header invalid"} def test_get_invalid_one_users(): response = client.get("/users/", headers={"X-Token": "invalid"})
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 8.4K bytes - Viewed (0) -
docs_src/request_files/tutorial002_py39.py
app = FastAPI() @app.post("/files/") async def create_files(files: list[bytes] = File()): return {"file_sizes": [len(file) for file in files]} @app.post("/uploadfiles/") async def create_upload_files(files: list[UploadFile]): return {"filenames": [file.filename for file in files]} @app.get("/") async def main(): content = """ <body>
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri May 13 23:38:22 UTC 2022 - 786 bytes - Viewed (0) -
tests/test_computed_fields.py
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Oct 12 09:44:57 UTC 2024 - 3K bytes - Viewed (0) -
docs_src/dependencies/tutorial008_an.py
from typing_extensions import Annotated async def dependency_a(): dep_a = generate_dep_a() try: yield dep_a finally: dep_a.close() async def dependency_b(dep_a: Annotated[DepA, Depends(dependency_a)]): dep_b = generate_dep_b() try: yield dep_b finally: dep_b.close(dep_a) async def dependency_c(dep_b: Annotated[DepB, Depends(dependency_b)]):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 531 bytes - Viewed (0)