🎨 [pre-commit.ci] Auto format from pre-commit.com hooks

This commit is contained in:
pre-commit-ci[bot] 2022-09-12 17:48:25 +00:00
parent 180a22d89d
commit f32f00bb68
2 changed files with 10 additions and 3 deletions

View File

@ -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)

View File

@ -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():
...