fix, attempt to satisfy the linter

This commit is contained in:
Alex 2023-02-04 19:14:35 +02:00
parent 9bd88edeba
commit 8c283ee242
2 changed files with 3 additions and 3 deletions

View file

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

View file

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