mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-09 18:27:56 +08:00
🐛 修正项目的代码警告 (#614)
* 🐛 调整ruff的pytest警告 * 🐛 调整导入关系警告 * 🐛 删除奇怪无用的赋值和取值逻辑 * ✅ 不同测试部分所用变量应加以区分 * 🐛 subs_io model添加默认值 * 🐛 修完所有的 ruff PT001 警告 * 🔧 按ruff建议修改ruff配置 warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `pyproject.toml`: - 'ignore' -> 'lint.ignore' - 'select' -> 'lint.select' --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -10,7 +10,7 @@ if typing.TYPE_CHECKING:
|
||||
from nonebot_bison.config.config_legacy import Config
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
@pytest.fixture
|
||||
def config_legacy(app: App, use_legacy_config):
|
||||
from nonebot_bison.config import config_legacy as config
|
||||
|
||||
|
||||
@@ -52,18 +52,18 @@ async def test_add_subscribe(app: App, init_scheduler):
|
||||
)
|
||||
confs = await config.list_subscribe(TargetQQGroup(group_id=123))
|
||||
assert len(confs) == 1
|
||||
conf: Subscribe = confs[0]
|
||||
conf2: Subscribe = confs[0]
|
||||
async with AsyncSession(get_engine()) as sess:
|
||||
related_user_obj = await sess.scalar(select(User).where(User.id == conf.user_id))
|
||||
related_target_obj = await sess.scalar(select(Target).where(Target.id == conf.target_id))
|
||||
related_user_obj = await sess.scalar(select(User).where(User.id == conf2.user_id))
|
||||
related_target_obj = await sess.scalar(select(Target).where(Target.id == conf2.target_id))
|
||||
assert related_user_obj
|
||||
assert related_target_obj
|
||||
assert related_user_obj.user_target["group_id"] == 123
|
||||
assert related_target_obj.target_name == "weibo_name2"
|
||||
assert related_target_obj.target == "weibo_id"
|
||||
assert conf.target.target == "weibo_id"
|
||||
assert conf.categories == [1]
|
||||
assert conf.tags == ["tag"]
|
||||
assert conf2.target.target == "weibo_id"
|
||||
assert conf2.categories == [1]
|
||||
assert conf2.tags == ["tag"]
|
||||
|
||||
|
||||
async def test_add_dup_sub(init_scheduler):
|
||||
|
||||
Reference in New Issue
Block a user