- Sort Score
- Result 10 results
- Languages All
Results 331 - 340 of 1,379 for def2 (0.02 sec)
-
tests/test_tutorial/test_query_params_str_validations/test_tutorial011_an.py
from docs_src.query_params_str_validations.tutorial011_an 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) -
tests/test_repeated_parameter_alias.py
from fastapi.testclient import TestClient app = FastAPI() @app.get("/{repeated_alias}") def get_parameters_with_repeated_aliases( path: str = Path(..., alias="repeated_alias"), query: str = Query(..., alias="repeated_alias"), ): return {"path": path, "query": query} client = TestClient(app) def test_get_parameters(): response = client.get("/test_path", params={"repeated_alias": "test_query"})
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 3.7K bytes - Viewed (0) -
docs/pt/docs/advanced/dataclasses.md
Novamente, você pode combinar `dataclasses` com anotações de tipo padrão. 8. Note que esta *função de operação de rota* usa `def` regular em vez de `async def`. Como sempre, no FastAPI você pode combinar `def` e `async def` conforme necessário.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Oct 22 17:33:53 UTC 2024 - 4.4K bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial003_py39.py
import pytest from fastapi import FastAPI from fastapi.testclient import TestClient from ...utils import needs_py39 @pytest.fixture(name="app") def get_app(): from docs_src.request_files.tutorial003_py39 import app return app @pytest.fixture(name="client") def get_client(app: FastAPI): client = TestClient(app) return client file_required = { "detail": [ {
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 7.6K bytes - Viewed (0) -
tests/test_tutorial/test_header_param_models/test_tutorial001.py
pytest.param("tutorial001_an_py310", marks=needs_py310), ], ) def get_client(request: pytest.FixtureRequest): mod = importlib.import_module(f"docs_src.header_param_models.{request.param}") client = TestClient(mod.app) return client def test_header_param_model(client: TestClient): response = client.get( "/items/", headers=[
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Sep 17 18:54:10 UTC 2024 - 8.7K bytes - Viewed (0) -
tests/test_tutorial/test_body_multiple_params/test_tutorial001_an_py39.py
from dirty_equals import IsDict from fastapi.testclient import TestClient from ...utils import needs_py39 @pytest.fixture(name="client") def get_client(): from docs_src.body_multiple_params.tutorial001_an_py39 import app client = TestClient(app) return client @needs_py39 def test_post_body_q_bar_content(client: TestClient): response = client.put("/items/5?q=bar", json={"name": "Foo", "price": 50.5})
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 7.6K bytes - Viewed (0) -
tests/test_tutorial/test_security/test_tutorial001.py
from docs_src.security.tutorial001 import app client = TestClient(app) def test_no_token(): response = client.get("/items") assert response.status_code == 401, response.text assert response.json() == {"detail": "Not authenticated"} assert response.headers["WWW-Authenticate"] == "Bearer" def test_token(): response = client.get("/items", headers={"Authorization": "Bearer testtoken"})
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 1.9K bytes - Viewed (0) -
docs_src/separate_openapi_schemas/tutorial002.py
class Item(BaseModel): name: str description: Union[str, None] = None app = FastAPI(separate_input_output_schemas=False) @app.post("/items/") def create_item(item: Item): return item @app.get("/items/") def read_items() -> List[Item]: return [ Item( name="Portal Gun", description="Device to travel through the multi-rick-verse", ),
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Aug 25 19:10:22 UTC 2023 - 524 bytes - Viewed (0) -
tests/test_tutorial/test_path_params/test_tutorial005.py
from docs_src.path_params.tutorial005 import app client = TestClient(app) def test_get_enums_alexnet(): response = client.get("/models/alexnet") assert response.status_code == 200 assert response.json() == {"model_name": "alexnet", "message": "Deep Learning FTW!"} def test_get_enums_lenet(): response = client.get("/models/lenet") assert response.status_code == 200
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Sep 28 04:14:40 UTC 2023 - 5K bytes - Viewed (0) -
tests/test_tutorial/test_dependencies/test_tutorial006.py
}, ] } ) def test_get_invalid_one_header(): 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_second_header(): response = client.get(
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 5K bytes - Viewed (0)