From f32f00bb68170379e8bb62e44d427ba544b2410f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 12 Sep 2022 17:48:25 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20[pre-commit.ci]=20Auto=20format?= =?UTF-8?q?=20from=20pre-commit.com=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastapi/routing.py | 12 +++++++++--- tests/test_tags.py | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/fastapi/routing.py b/fastapi/routing.py index 5899af62a..629b71c6a 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -501,7 +501,9 @@ class APIRouter(routing.Router): self.prefix = prefix if tags: if isinstance(tags, str): - raise TypeError(f"""tags should not be a string: please use ["{tags}"] instead of "{tags}".""") + raise TypeError( + f"""tags should not be a string: please use ["{tags}"] instead of "{tags}".""" + ) self.tags: List[Union[str, Enum]] = tags or [] self.dependencies = list(dependencies or []) or [] self.deprecated = deprecated @@ -556,7 +558,9 @@ class APIRouter(routing.Router): current_tags = self.tags.copy() if tags: if isinstance(tags, str): - raise TypeError(f"""tags should not be a string: please use ["{tags}"] instead of "{tags}".""") + raise TypeError( + f"""tags should not be a string: please use ["{tags}"] instead of "{tags}".""" + ) current_tags.extend(tags) current_dependencies = self.dependencies.copy() if dependencies: @@ -722,7 +726,9 @@ class APIRouter(routing.Router): current_tags = [] if tags: if isinstance(tags, str): - raise TypeError(f"""tags should not be a string: please use ["{tags}"] instead of "{tags}".""") + raise TypeError( + f"""tags should not be a string: please use ["{tags}"] instead of "{tags}".""" + ) current_tags.extend(tags) if route.tags: current_tags.extend(route.tags) diff --git a/tests/test_tags.py b/tests/test_tags.py index e5471f32c..ea2b2b063 100644 --- a/tests/test_tags.py +++ b/tests/test_tags.py @@ -11,6 +11,7 @@ def test_string_is_invalid_in_router_route_tags(): router = APIRouter() with pytest.raises(TypeError): + @router.get("", tags="test") def test(): ...