mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-27 16:21:28 +00:00
✅ add param tests
This commit is contained in:
14
tests/plugins/param/param_arg.py
Normal file
14
tests/plugins/param/param_arg.py
Normal file
@ -0,0 +1,14 @@
|
||||
from nonebot.adapters import Event, Message
|
||||
from nonebot.params import Arg, ArgStr, ArgEvent
|
||||
|
||||
|
||||
async def arg(key: Message = Arg()) -> Message:
|
||||
return key
|
||||
|
||||
|
||||
async def arg_str(key: str = ArgStr()) -> str:
|
||||
return key
|
||||
|
||||
|
||||
async def arg_event(key: Event = ArgEvent()) -> Event:
|
||||
return key
|
2
tests/plugins/param/param_default.py
Normal file
2
tests/plugins/param/param_default.py
Normal file
@ -0,0 +1,2 @@
|
||||
async def default(value: int = 1) -> int:
|
||||
return value
|
6
tests/plugins/param/param_exception.py
Normal file
6
tests/plugins/param/param_exception.py
Normal file
@ -0,0 +1,6 @@
|
||||
from typing import Union
|
||||
|
||||
|
||||
async def exc(e: Exception, x: Union[ValueError, TypeError]) -> Exception:
|
||||
assert e == x
|
||||
return e
|
Reference in New Issue
Block a user