mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-06 12:06:45 +00:00
✅ add matcher updater tests
This commit is contained in:
7
tests/plugins/matcher/__init__.py
Normal file
7
tests/plugins/matcher/__init__.py
Normal file
@ -0,0 +1,7 @@
|
||||
from pathlib import Path
|
||||
|
||||
from nonebot import load_plugins
|
||||
|
||||
_sub_plugins = set()
|
||||
|
||||
_sub_plugins |= load_plugins(str(Path(__file__).parent))
|
13
tests/plugins/matcher/matcher_permission.py
Normal file
13
tests/plugins/matcher/matcher_permission.py
Normal file
@ -0,0 +1,13 @@
|
||||
from nonebot.matcher import Matcher
|
||||
from nonebot.permission import Permission
|
||||
|
||||
default_permission = Permission()
|
||||
|
||||
test_permission_updater = Matcher.new(permission=default_permission)
|
||||
|
||||
test_custom_updater = Matcher.new(permission=default_permission)
|
||||
|
||||
|
||||
@test_custom_updater.permission_updater
|
||||
async def _() -> Permission:
|
||||
return default_permission
|
10
tests/plugins/matcher/matcher_type.py
Normal file
10
tests/plugins/matcher/matcher_type.py
Normal file
@ -0,0 +1,10 @@
|
||||
from nonebot.matcher import Matcher
|
||||
|
||||
test_type_updater = Matcher.new(type_="test")
|
||||
|
||||
test_custom_updater = Matcher.new(type_="test")
|
||||
|
||||
|
||||
@test_custom_updater.type_updater
|
||||
async def _() -> str:
|
||||
return "custom"
|
Reference in New Issue
Block a user