mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-16 19:11:00 +00:00
🐛 fix rule checker not parsed
This commit is contained in:
18
tests/test_rule.py
Normal file
18
tests/test_rule.py
Normal file
@ -0,0 +1,18 @@
|
||||
import pytest
|
||||
from nonebug import App
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_command(app: App):
|
||||
from nonebot.consts import CMD_KEY, PREFIX_KEY
|
||||
from nonebot.rule import Rule, CommandRule, command
|
||||
|
||||
test_command = command("help")
|
||||
dependent = list(test_command.checkers)[0]
|
||||
checker = dependent.call
|
||||
|
||||
assert isinstance(checker, CommandRule)
|
||||
assert checker.cmds == [("help",)]
|
||||
|
||||
state = {PREFIX_KEY: {CMD_KEY: ("help",)}}
|
||||
assert await dependent(state=state)
|
Reference in New Issue
Block a user