mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 00:55:07 +08:00
🐛 fix rule checker not parsed
This commit is contained in:
parent
e3aba26080
commit
76104d3237
@ -98,7 +98,9 @@ class Rule:
|
|||||||
self.checkers: Set[Dependent[bool]] = set(
|
self.checkers: Set[Dependent[bool]] = set(
|
||||||
checker
|
checker
|
||||||
if isinstance(checker, Dependent)
|
if isinstance(checker, Dependent)
|
||||||
else Dependent[bool](call=checker, allow_types=self.HANDLER_PARAM_TYPES)
|
else Dependent[bool].parse(
|
||||||
|
call=checker, allow_types=self.HANDLER_PARAM_TYPES
|
||||||
|
)
|
||||||
for checker in checkers
|
for checker in checkers
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
|
18
poetry.lock
generated
18
poetry.lock
generated
@ -319,7 +319,7 @@ name = "h2"
|
|||||||
version = "4.1.0"
|
version = "4.1.0"
|
||||||
description = "HTTP/2 State-Machine based protocol implementation"
|
description = "HTTP/2 State-Machine based protocol implementation"
|
||||||
category = "main"
|
category = "main"
|
||||||
optional = false
|
optional = true
|
||||||
python-versions = ">=3.6.1"
|
python-versions = ">=3.6.1"
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
@ -331,7 +331,7 @@ name = "hpack"
|
|||||||
version = "4.0.0"
|
version = "4.0.0"
|
||||||
description = "Pure-Python HPACK header compression"
|
description = "Pure-Python HPACK header compression"
|
||||||
category = "main"
|
category = "main"
|
||||||
optional = false
|
optional = true
|
||||||
python-versions = ">=3.6.1"
|
python-versions = ">=3.6.1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -347,7 +347,7 @@ name = "httpcore"
|
|||||||
version = "0.14.3"
|
version = "0.14.3"
|
||||||
description = "A minimal low-level HTTP client."
|
description = "A minimal low-level HTTP client."
|
||||||
category = "main"
|
category = "main"
|
||||||
optional = false
|
optional = true
|
||||||
python-versions = ">=3.6"
|
python-versions = ">=3.6"
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
@ -375,7 +375,7 @@ name = "httpx"
|
|||||||
version = "0.21.1"
|
version = "0.21.1"
|
||||||
description = "The next generation HTTP client."
|
description = "The next generation HTTP client."
|
||||||
category = "main"
|
category = "main"
|
||||||
optional = false
|
optional = true
|
||||||
python-versions = ">=3.6"
|
python-versions = ">=3.6"
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
@ -417,7 +417,7 @@ name = "hyperframe"
|
|||||||
version = "6.0.1"
|
version = "6.0.1"
|
||||||
description = "HTTP/2 framing layer for Python"
|
description = "HTTP/2 framing layer for Python"
|
||||||
category = "main"
|
category = "main"
|
||||||
optional = false
|
optional = true
|
||||||
python-versions = ">=3.6.1"
|
python-versions = ">=3.6.1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -819,7 +819,7 @@ name = "rfc3986"
|
|||||||
version = "1.5.0"
|
version = "1.5.0"
|
||||||
description = "Validating URI References per RFC 3986"
|
description = "Validating URI References per RFC 3986"
|
||||||
category = "main"
|
category = "main"
|
||||||
optional = false
|
optional = true
|
||||||
python-versions = "*"
|
python-versions = "*"
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
@ -1176,13 +1176,15 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes
|
|||||||
|
|
||||||
[extras]
|
[extras]
|
||||||
aiohttp = ["aiohttp"]
|
aiohttp = ["aiohttp"]
|
||||||
all = ["Quart", "aiohttp"]
|
all = ["Quart", "aiohttp", "httpx", "websockets"]
|
||||||
|
httpx = ["httpx"]
|
||||||
quart = ["Quart"]
|
quart = ["Quart"]
|
||||||
|
websockets = ["websockets"]
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "1.1"
|
lock-version = "1.1"
|
||||||
python-versions = "^3.7.3"
|
python-versions = "^3.7.3"
|
||||||
content-hash = "e32c99ae82181567b69bc70580e3c0d816a522d0174fce2ce04c773219f1bb50"
|
content-hash = "f917cb99a90280fb78a3d5e51410d89c364a05d917951a90c1c5af0bda1f08c3"
|
||||||
|
|
||||||
[metadata.files]
|
[metadata.files]
|
||||||
aiodns = [
|
aiodns = [
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
from typing import TYPE_CHECKING, Set
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from nonebug import App
|
from nonebug import App
|
||||||
|
|
||||||
|
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)
|
Loading…
Reference in New Issue
Block a user