mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-16 19:11:00 +00:00
✨ Feature: 兼容 Pydantic v2 (#2544)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -218,7 +218,7 @@ async def test_event(app: App):
|
||||
|
||||
async with app.test_dependent(union_event, allow_types=[EventParam]) as ctx:
|
||||
ctx.pass_params(event=fake_fooevent)
|
||||
ctx.should_return(fake_event)
|
||||
ctx.should_return(fake_fooevent)
|
||||
|
||||
async with app.test_dependent(generic_event, allow_types=[EventParam]) as ctx:
|
||||
ctx.pass_params(event=fake_event)
|
||||
@ -529,13 +529,17 @@ async def test_arg(app: App):
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_exception(app: App):
|
||||
from plugins.param.param_exception import exc
|
||||
from plugins.param.param_exception import exc, legacy_exc
|
||||
|
||||
exception = ValueError("test")
|
||||
async with app.test_dependent(exc, allow_types=[ExceptionParam]) as ctx:
|
||||
ctx.pass_params(exception=exception)
|
||||
ctx.should_return(exception)
|
||||
|
||||
async with app.test_dependent(legacy_exc, allow_types=[ExceptionParam]) as ctx:
|
||||
ctx.pass_params(exception=exception)
|
||||
ctx.should_return(exception)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_default(app: App):
|
||||
|
Reference in New Issue
Block a user