From 9b83aa36dbdc5f64f42d6674269cfdcdf6777e8c Mon Sep 17 00:00:00 2001 From: Yuriy Chebyshev Date: Tue, 12 Jul 2022 13:59:39 +0300 Subject: [PATCH] CR fix: add forgotten format --- aiogram/dispatcher/filters/builtin.py | 5 ++--- tests/test_dispatcher/test_filters/test_builtin.py | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/aiogram/dispatcher/filters/builtin.py b/aiogram/dispatcher/filters/builtin.py index 73530c70..c46c26cc 100644 --- a/aiogram/dispatcher/filters/builtin.py +++ b/aiogram/dispatcher/filters/builtin.py @@ -71,13 +71,12 @@ class Command(Filter): elif isinstance(commands, Iterable): if not all(map(lambda cmd: isinstance(cmd, str), commands)): raise ValueError( - "Command filter doesn't support {} as input. " - "It only supports str, BotCommand object or their Iterable" + "Command filter only supports str, BotCommand object or their Iterable" ) else: raise ValueError( "Command filter doesn't support {} as input. " - "It only supports str, BotCommand object or their Iterable" + "It only supports str, BotCommand object or their Iterable".format(type(commands)) ) commands = [cmd.command if isinstance(cmd, BotCommand) else cmd for cmd in commands] diff --git a/tests/test_dispatcher/test_filters/test_builtin.py b/tests/test_dispatcher/test_filters/test_builtin.py index 472a1f7b..0ca0b5c2 100644 --- a/tests/test_dispatcher/test_filters/test_builtin.py +++ b/tests/test_dispatcher/test_filters/test_builtin.py @@ -141,8 +141,9 @@ async def test_commands_filter_not_checked(): assert not await start_filter.check(message_with_command) -@pytest.mark.asyncio -async def test_commands_filter_not_checked(): +def test_commands_filter_not_checked(): with pytest.raises(ValueError): start_filter = Command(commands=42) # noqa + with pytest.raises(ValueError): + start_filter = Command(commands=[42]) # noqa