mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
fix, attempt to satisfy the linter
This commit is contained in:
parent
9bd88edeba
commit
8c283ee242
2 changed files with 3 additions and 3 deletions
|
|
@ -87,14 +87,13 @@ class Command(Filter):
|
|||
"Command filter only supports str, re.Pattern, BotCommand object"
|
||||
" or their Iterable"
|
||||
)
|
||||
if ignore_case and isinstance(command, str):
|
||||
command = command.casefold()
|
||||
items.append(command)
|
||||
|
||||
if not items:
|
||||
raise ValueError("At least one command should be specified")
|
||||
|
||||
if ignore_case:
|
||||
items = map(str.casefold, items)
|
||||
|
||||
self.commands = tuple(items)
|
||||
self.prefix = prefix
|
||||
self.ignore_case = ignore_case
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ class TestCommandFilter:
|
|||
[("12TeSt", "3t4Est", "5TE6sT"), ("12test", "3t4est", "5te6st")],
|
||||
[[BotCommand(command="Test", description="Test1")], ("test",)],
|
||||
[[BotCommand(command="tEsT", description="Test2")], ("test",)],
|
||||
[(re.compile(r"test(\d+)"), 'TeSt'), (re.compile(r"test(\d+)"), "test")],
|
||||
],
|
||||
)
|
||||
def test_init_casefold(self, commands, checklist):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue