From 4e2cfc24be0fe3a961a8c27f9bd378610b091dc3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Tue, 30 Dec 2025 17:18:34 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Auto=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastapi/dependencies/utils.py | 8 +++----- tests/test_dependency_overrides.py | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fastapi/dependencies/utils.py b/fastapi/dependencies/utils.py index 7b6006dba7..ed717f63a4 100644 --- a/fastapi/dependencies/utils.py +++ b/fastapi/dependencies/utils.py @@ -109,9 +109,7 @@ def ensure_multipart_is_installed() -> None: raise RuntimeError(multipart_not_installed_error) from None -def get_parameterless_sub_dependant( - *, depends: params.Depends, path: str -) -> Dependant: +def get_parameterless_sub_dependant(*, depends: params.Depends, path: str) -> Dependant: assert callable(depends.dependency), ( "A parameter-less dependency must have a callable dependency" ) @@ -299,7 +297,7 @@ def get_dependant( ): raise FastAPIError( f'Dependency parameter "{param_name}" must have a type annotation. ' - f'For example: `{param_name}: SomeType = Depends(...)`' + f"For example: `{param_name}: SomeType = Depends(...)`" ) if ( (dependant.is_gen_callable or dependant.is_async_gen_callable) @@ -339,7 +337,7 @@ def get_dependant( if enforce_annotation and param_details.field is None: raise FastAPIError( f'Dependency parameter "{param_name}" must have a type annotation. ' - f'For example: `{param_name}: SomeType = Depends(...)`' + f"For example: `{param_name}: SomeType = Depends(...)`" ) if isinstance(param_details.field.field_info, params.Body): dependant.body_params.append(param_details.field) diff --git a/tests/test_dependency_overrides.py b/tests/test_dependency_overrides.py index 310cf51a50..fbbcacbc6b 100644 --- a/tests/test_dependency_overrides.py +++ b/tests/test_dependency_overrides.py @@ -399,9 +399,11 @@ def test_missing_type_annotation_dependency(): return "db" with pytest.raises(FastAPIError) as exc: + @local_app.get("/bad") def bad(dep=Depends(get_db)): return dep + TestClient(local_app) msg = str(exc.value)