- Sort Score
- Result 10 results
- Languages All
Results 21 - 30 of 270 for MyTest (0.04 sec)
-
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_response_model_invalid.py
from typing import List import pytest from fastapi import FastAPI from fastapi.exceptions import FastAPIError class NonPydanticModel: pass 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():
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_validate_response_dataclass.py
] client = TestClient(app) def test_invalid(): with pytest.raises(ResponseValidationError): client.get("/items/invalid") def test_double_invalid(): with pytest.raises(ResponseValidationError): client.get("/items/innerinvalid") def test_invalid_list(): with pytest.raises(ResponseValidationError):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 1.2K bytes - Viewed (0) -
docs/zh/docs/tutorial/testing.md
/// ## 运行起来 之后,你只需要安装 `pytest`: <div class="termy"> ```console $ pip install pytest ---> 100% ``` </div> 他会自动检测文件和测试,执行测试,然后向你报告结果。 执行测试: <div class="termy"> ```console $ pytest ================ test session starts ================ platform linux -- Python 3.6.9, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 6K bytes - Viewed (0) -
tests/test_tutorial/test_websockets/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.websockets.tutorial003_py39 import app return app @pytest.fixture(name="html") def get_html(): from docs_src.websockets.tutorial003_py39 import html return html @pytest.fixture(name="client")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 1.3K bytes - Viewed (0) -
tests/test_tutorial/test_dependencies/test_tutorial008d_an_py39.py
import pytest from fastapi.testclient import TestClient from ...utils import needs_py39 @pytest.fixture(name="client") def get_client(): from docs_src.dependencies.tutorial008d_an_py39 import app client = TestClient(app) return client @needs_py39 def test_get_no_item(client: TestClient): response = client.get("/items/foo") assert response.status_code == 404, response.text
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Feb 24 23:06:37 UTC 2024 - 1.3K bytes - Viewed (0) -
tests/test_tutorial/test_dependencies/test_tutorial008c_an_py39.py
import pytest from fastapi.exceptions import FastAPIError from fastapi.testclient import TestClient from ...utils import needs_py39 @pytest.fixture(name="client") def get_client(): from docs_src.dependencies.tutorial008c_an_py39 import app client = TestClient(app) return client @needs_py39 def test_get_no_item(client: TestClient): response = client.get("/items/foo")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Feb 24 23:06:37 UTC 2024 - 1.2K bytes - Viewed (0) -
tests/test_tutorial/test_events/test_tutorial001.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.tutorial001 import app yield app def test_events(app: FastAPI): with TestClient(app) as client: response = client.get("/items/foo") 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 - 3.6K bytes - Viewed (0) -
tests/test_invalid_path_param.py
import pytest from fastapi import FastAPI from pydantic import BaseModel def test_invalid_sequence(): with pytest.raises(AssertionError): app = FastAPI() class Item(BaseModel): title: str @app.get("/items/{id}") def read_items(id: List[Item]): pass # pragma: no cover def test_invalid_tuple(): with pytest.raises(AssertionError):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon Jun 03 17:59:40 UTC 2019 - 1.7K bytes - Viewed (0) -
tests/test_schema_extra_examples.py
): return item_id with pytest.warns(DeprecationWarning): @app.get("/path_example_examples/{item_id}") def path_example_examples( item_id: str = Path( example="item_overridden", examples=["item_1", "item_2"], ), ): return item_id with pytest.warns(DeprecationWarning):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Oct 24 20:26:06 UTC 2023 - 37.7K bytes - Viewed (0)