- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 20 for test_read_items (0.07 sec)
-
tests/test_tutorial/test_testing/test_tutorial003.py
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 172 bytes - Viewed (0) -
tests/test_tutorial/test_testing/test_tutorial004.py
from docs_src.app_testing.tutorial004_py39 import test_read_items def test_main():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 107 bytes - Viewed (0) -
docs_src/app_testing/tutorial003_py39.py
async def startup_event(): items["foo"] = {"name": "Fighters"} items["bar"] = {"name": "Tenders"} @app.get("/items/{item_id}") async def read_items(item_id: str): return items[item_id] def test_read_items(): with TestClient(app) as client: response = client.get("/items/foo") assert response.status_code == 200
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 528 bytes - Viewed (0) -
tests/test_tutorial/test_separate_openapi_schemas/test_tutorial002.py
response = client.post("/items/", json={"name": "Foo"}) assert response.status_code == 200, response.text assert response.json() == {"name": "Foo", "description": None} def test_read_items(client: TestClient) -> None: response = client.get("/items/") assert response.status_code == 200, response.text assert response.json() == [ { "name": "Portal Gun",
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 5K bytes - Viewed (0) -
tests/test_tutorial/test_response_model/test_tutorial001_tutorial001_01.py
], ) def get_client(request: pytest.FixtureRequest): mod = importlib.import_module(f"docs_src.response_model.{request.param}") client = TestClient(mod.app) return client def test_read_items(client: TestClient): response = client.get("/items/") assert response.status_code == 200, response.text assert response.json() == [ { "name": "Portal Gun",
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 6.5K bytes - Viewed (0) -
tests/test_tutorial/test_path_params_numeric_validations/test_tutorial006.py
{"item_id": 0, "size": 0.1}, ), ( "/items/1000?q=somequery&size=10.4", {"item_id": 1000, "q": "somequery", "size": 10.4}, ), ], ) def test_read_items(client: TestClient, path, expected_response): response = client.get(path) assert response.status_code == 200, response.text assert response.json() == expected_responseRegistered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 7.3K bytes - Viewed (0) -
tests/test_tutorial/test_path_params_numeric_validations/test_tutorial005.py
@pytest.mark.parametrize( "path,expected_response", [ ("/items/1?q=", {"item_id": 1}), ("/items/1000?q=somequery", {"item_id": 1000, "q": "somequery"}), ], ) def test_read_items(client: TestClient, path, expected_response): response = client.get(path) assert response.status_code == 200, response.text assert response.json() == expected_response
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 6.6K bytes - Viewed (0) -
docs_src/app_testing/tutorial004_py39.py
yield # clean up items items.clear() app = FastAPI(lifespan=lifespan) @app.get("/items/{item_id}") async def read_items(item_id: str): return items[item_id] def test_read_items(): # Before the lifespan starts, "items" is still empty assert items == {} with TestClient(app) as client: # Inside the "with TestClient" block, the lifespan starts and items addedRegistered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 1.2K bytes - Viewed (0) -
tests/test_tutorial/test_path_params_numeric_validations/test_tutorial001.py
@pytest.mark.parametrize( "path,expected_response", [ ("/items/42", {"item_id": 42}), ("/items/123?item-query=somequery", {"item_id": 123, "q": "somequery"}), ], ) def test_read_items(client: TestClient, path, expected_response): response = client.get(path) assert response.status_code == 200, response.text assert response.json() == expected_response
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 5.6K bytes - Viewed (0) -
tests/test_tutorial/test_separate_openapi_schemas/test_tutorial001.py
response = client.post("/items/", json={"name": "Foo"}) assert response.status_code == 200, response.text assert response.json() == {"name": "Foo", "description": None} def test_read_items(client: TestClient) -> None: response = client.get("/items/") assert response.status_code == 200, response.text assert response.json() == [ { "name": "Portal Gun",
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 5K bytes - Viewed (0)