- Sort Score
- Result 10 results
- Languages All
Results 351 - 360 of 1,379 for def2 (0.05 sec)
-
tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial005.py
from fastapi.testclient import TestClient from docs_src.path_operation_advanced_configuration.tutorial005 import app client = TestClient(app) def test_get(): response = client.get("/items/") assert response.status_code == 200, response.text def test_openapi_schema(): response = client.get("/openapi.json") assert response.status_code == 200, response.text assert response.json() == { "openapi": "3.1.0",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 1K bytes - Viewed (0) -
tests/test_additional_responses_response_class.py
response_class=JsonApiResponse, 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.5K bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial002_an.py
assert response.json() == {"filenames": ["test.txt", "test2.txt"]} def test_get_root(): client = TestClient(app) response = client.get("/") assert response.status_code == 200, response.text assert b"<form" in response.content 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: Thu Apr 18 19:40:57 UTC 2024 - 8.5K bytes - Viewed (0) -
tests/test_path.py
client = TestClient(app) def test_text_get(): response = client.get("/text") assert response.status_code == 200, response.text assert response.json() == "Hello World" def test_nonexistent(): response = client.get("/nonexistent") assert response.status_code == 404, response.text assert response.json() == {"detail": "Not Found"} def test_path_foobar():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 34.4K bytes - Viewed (0) -
tests/test_response_model_as_return_annotation.py
@app.get("/no_response_model-no_annotation-return_model") def no_response_model_no_annotation_return_model(): return User(name="John", surname="Doe") @app.get("/no_response_model-no_annotation-return_dict") def no_response_model_no_annotation_return_dict(): return {"name": "John", "surname": "Doe"} @app.get("/response_model-no_annotation-return_same_model", response_model=User) def response_model_no_annotation_return_same_model():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon Aug 14 09:49:57 UTC 2023 - 47.7K bytes - Viewed (0) -
tests/test_tutorial/test_query_params/test_tutorial006.py
import pytest from dirty_equals import IsDict from fastapi.testclient import TestClient @pytest.fixture(name="client") def get_client(): from docs_src.query_params.tutorial006 import app c = TestClient(app) return c def test_foo_needy_very(client: TestClient): response = client.get("/items/foo?needy=very") assert response.status_code == 200 assert response.json() == { "item_id": "foo",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 6.1K bytes - Viewed (0) -
fastapi/utils.py
}: return True current_status_code = int(status_code) return not (current_status_code < 200 or current_status_code in {204, 205, 304}) def get_path_param_names(path: str) -> Set[str]: return set(re.findall("{(.*?)}", path)) def create_model_field( name: str, type_: Any, class_validators: Optional[Dict[str, Validator]] = None, default: Optional[Any] = Undefined,
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Aug 31 23:46:03 UTC 2024 - 7.8K bytes - Viewed (0) -
tests/test_tutorial/test_advanced_middleware/test_tutorial003.py
from fastapi.testclient import TestClient from docs_src.advanced_middleware.tutorial003 import app @app.get("/large") async def large(): return PlainTextResponse("x" * 4000, status_code=200) client = TestClient(app) def test_middleware(): response = client.get("/large", headers={"accept-encoding": "gzip"}) assert response.status_code == 200, response.text
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Jul 09 18:06:12 UTC 2020 - 665 bytes - Viewed (0) -
docs_src/dependencies/tutorial004.py
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}] class CommonQueryParams: def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100): self.q = q self.skip = skip self.limit = limit @app.get("/items/") async def read_items(commons: CommonQueryParams = Depends()): response = {} if commons.q: response.update({"q": commons.q})
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat May 14 11:59:59 UTC 2022 - 639 bytes - Viewed (0) -
docs_src/dependencies/tutorial008c.py
from fastapi import Depends, FastAPI, HTTPException app = FastAPI() class InternalError(Exception): pass def get_username(): try: yield "Rick" except InternalError: print("Oops, we didn't raise again, Britney 😱") @app.get("/items/{item_id}") def get_item(item_id: str, username: str = Depends(get_username)): if item_id == "portal-gun": raise InternalError(
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Feb 24 23:06:37 UTC 2024 - 660 bytes - Viewed (0)