- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 18 for ValueError (1.46 sec)
-
tests/test_dependency_after_yield_raise.py
try: yield "s" except CustomError as err: raise HTTPException(status_code=418, detail="Session error") from err def broken_dep() -> Any: yield "s" raise ValueError("Broken after yield") app = FastAPI() @app.get("/catching") def catching(d: Annotated[str, Depends(catching_dep)]) -> Any: raise CustomError("Simulated error during streaming")Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 1.7K bytes - Viewed (0) -
docs/sts/client_grants/sts_element.py
from xml.etree import cElementTree from xml.etree.cElementTree import ParseError if hasattr(cElementTree, 'ParseError'): _ETREE_EXCEPTIONS = (ParseError, AttributeError, ValueError, TypeError) else: _ETREE_EXCEPTIONS = (SyntaxError, AttributeError, ValueError, TypeError) _STS_NS = {'sts': 'https://sts.amazonaws.com/doc/2011-06-15/'} class STSElement(object): """STS aware XML parsing class. Wraps a root element name and
Registered: Sun Dec 28 19:28:13 UTC 2025 - Last Modified: Fri Apr 23 18:58:53 UTC 2021 - 2.5K bytes - Viewed (0) -
tests/test_dependency_after_yield_streaming.py
assert response.status_code == 500 assert response.text == "Internal Server Error" def test_broken_session_stream_raise(): # Can raise ValueError on Pydantic v2 and ExceptionGroup on Pydantic v1 with pytest.raises((ValueError, Exception)): client.get("/broken-session-stream") def test_broken_session_stream_no_raise(): """Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 3.2K bytes - Viewed (0) -
tests/test_exception_handlers.py
RequestValidationError: request_validation_exception_handler, Exception: server_error_exception_handler, } ) client = TestClient(app) def raise_value_error(): raise ValueError() def dependency_with_yield(): yield raise_value_error() @app.get("/dependency-with-yield", dependencies=[Depends(dependency_with_yield)]) def with_yield(): ... @app.get("/http-exception")Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Tue Dec 03 22:37:12 UTC 2024 - 2.4K bytes - Viewed (0) -
tests/test_additional_responses_bad.py
"get": { "responses": { # this is how one would imagine the openapi schema to be # but since the key is not valid, openapi.utils.get_openapi will raise ValueError "hello": {"description": "Not a valid additional response"}, "200": { "description": "Successful Response",
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 1.1K bytes - Viewed (0) -
tests/test_openapi_schema_type.py
schema = Schema(type=type_value) assert schema.type == type_value def test_invalid_type_value() -> None: """Test that Schema raises ValueError for invalid type values.""" with pytest.raises(ValueError, match="2 validation errors for Schema"):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 730 bytes - Viewed (0) -
tests/test_dependency_after_yield_websockets.py
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 2K bytes - Viewed (0) -
tests/test_filter_pydantic_sub_model_pv2.py
foo: ModelB tags: dict[str, str] = {} @field_validator("name") def lower_username(cls, name: str, info: ValidationInfo): if not name.endswith("A"): raise ValueError("name must end in A") return name async def get_model_c() -> ModelC: return ModelC(username="test-user", password="test-password") @app.get("/model/{name}", response_model=ModelA)Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 6.6K bytes - Viewed (0) -
docs_src/query_params_str_validations/tutorial015_an_py310.py
"isbn-9781439512982": "Isaac Asimov: The Complete Stories, Vol. 2", } def check_valid_id(id: str): if not id.startswith(("isbn-", "imdb-")): raise ValueError('Invalid ID format, it must start with "isbn-" or "imdb-"') return id @app.get("/items/") async def read_items( id: Annotated[str | None, AfterValidator(check_valid_id)] = None, ): if id:
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Mar 01 22:02:35 UTC 2025 - 768 bytes - Viewed (0) -
docs_src/query_params_str_validations/tutorial015_an_py39.py
"isbn-9781439512982": "Isaac Asimov: The Complete Stories, Vol. 2", } def check_valid_id(id: str): if not id.startswith(("isbn-", "imdb-")): raise ValueError('Invalid ID format, it must start with "isbn-" or "imdb-"') return id @app.get("/items/") async def read_items( id: Annotated[Union[str, None], AfterValidator(check_valid_id)] = None, ): if id:
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Mar 01 22:02:35 UTC 2025 - 781 bytes - Viewed (0)