mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-09 18:27:56 +08:00
⬆️ 适配 Pydantic V2 (#484)
* ⬆️ 适配 Pydantic V2 * 🐛 修复测试报错 * 🐛 适配忘记的 from_orm * 🐛 忘记的 class-based `config` * 🐛 更新 red 适配器版本
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import pytest
|
||||
from nonebug.app import App
|
||||
from nonebot.compat import model_dump
|
||||
|
||||
from .utils import get_json
|
||||
|
||||
@@ -41,14 +42,14 @@ async def test_subs_export(app: App, init_scheduler):
|
||||
assert len(data) == 3
|
||||
|
||||
nbesf_data = await subscribes_export(lambda x: x)
|
||||
assert nbesf_data.dict() == get_json("v2/subs_export.json")
|
||||
assert model_dump(nbesf_data) == get_json("v2/subs_export.json")
|
||||
|
||||
nbesf_data_user_234 = await subscribes_export(
|
||||
lambda stmt: stmt.where(User.user_target == {"platform_type": "QQ Group", "group_id": 2342})
|
||||
)
|
||||
assert len(nbesf_data_user_234.groups) == 1
|
||||
assert len(nbesf_data_user_234.groups[0].subs) == 2
|
||||
assert nbesf_data_user_234.groups[0].user_target == {
|
||||
assert model_dump(nbesf_data_user_234.groups[0].user_target) == {
|
||||
"group_id": 2342,
|
||||
"platform_type": "QQ Group",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user