Added possibility to get command magic result as handler arguments

This commit is contained in:
Alex Root Junior 2022-04-15 22:45:12 +03:00
parent e8ed1b64d7
commit 21b9eecfd3
No known key found for this signature in database
GPG key ID: 074C1D455EBEA4AC
4 changed files with 25 additions and 9 deletions

View file

@ -92,6 +92,18 @@ class TestCommandFilter:
command = Command(commands=["test"])
assert bool(await command(message=message, bot=bot)) is result
async def test_command_magic_result(self, bot: MockedBot):
message = Message(
message_id=0,
text="/test 42",
chat=Chat(id=42, type="private"),
date=datetime.datetime.now(),
)
command = Command(commands=["test"], command_magic=(F.args.as_("args")))
result = await command(message=message, bot=bot)
assert "args" in result
assert result["args"] == "42"
class TestCommandObject:
@pytest.mark.parametrize(