- Sort Score
- Result 10 results
- Languages All
Results 1 - 2 of 2 for test_invalid_none (0.17 sec)
-
tests/test_validate_response.py
{"name": "baz", "price": "baz"}, ] client = TestClient(app) def test_invalid(): with pytest.raises(ResponseValidationError): client.get("/items/invalid") def test_invalid_none(): with pytest.raises(ResponseValidationError): client.get("/items/invalidnone") def test_valid_none_data(): response = client.get("/items/validnone") data = response.json()
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 2K bytes - Viewed (0) -
docs/en/docs/release-notes.md
class Item(BaseModel): name: str price: Optional[float] = None owner_ids: Optional[List[int]] = None app = FastAPI() @app.get("/items/invalidnone", response_model=Item) def get_invalid_none(): return None ``` ...calling the path `/items/invalidnone` will raise an error, because `None` is not a valid type for the `response_model` declared with `Item`.
Registered: Mon Jun 17 08:32:26 UTC 2024 - Last Modified: Fri Jun 14 15:07:37 UTC 2024 - 395.4K bytes - Viewed (0)