diff --git a/aiogram/dispatcher/filters/builtin.py b/aiogram/dispatcher/filters/builtin.py index cdf58ee0..e109eb6d 100644 --- a/aiogram/dispatcher/filters/builtin.py +++ b/aiogram/dispatcher/filters/builtin.py @@ -69,7 +69,7 @@ class Command(Filter): if isinstance(commands, (str, BotCommand)): commands = (commands,) elif isinstance(commands, Iterable): - if not all(map(lambda cmd: isinstance(cmd, (str, BotCommand)), commands)): + if not all(isinstance(cmd, (str, BotCommand)) for cmd in commands): raise ValueError( "Command filter only supports str, BotCommand object or their Iterable" ) diff --git a/tests/test_dispatcher/test_filters/test_builtin.py b/tests/test_dispatcher/test_filters/test_builtin.py index 0ca0b5c2..35e6cb0a 100644 --- a/tests/test_dispatcher/test_filters/test_builtin.py +++ b/tests/test_dispatcher/test_filters/test_builtin.py @@ -141,7 +141,7 @@ async def test_commands_filter_not_checked(): assert not await start_filter.check(message_with_command) -def test_commands_filter_not_checked(): +def test_commands_filter_raises_error(): with pytest.raises(ValueError): start_filter = Command(commands=42) # noqa with pytest.raises(ValueError):