mirror of https://github.com/tiangolo/fastapi.git
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
This commit is contained in:
parent
180a22d89d
commit
f32f00bb68
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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():
|
||||
...
|
||||
|
|
|
|||
Loading…
Reference in New Issue