Skip to content

Commit

Permalink
🐛 修正 TETR.IO 的字段类型
Browse files Browse the repository at this point in the history
  • Loading branch information
shoucandanghehe committed Nov 12, 2024
1 parent c5d4994 commit 66e44d2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ class Time(BaseModel):
zero: bool
locked: bool
prev: int
frameoffset: int
frameoffset: int | None = None


class Stats(BaseModel):
seed: int | None = None # ?: 不知道是之后都没有了还是还会有
seed: float | None = None # ?: 不知道是之后都没有了还是还会有
lines: int
level_lines: int
level_lines_needed: int
inputs: int
holds: int = 0
time: Time | None = None # ?: 不知道是之后都没有了还是还会有
score: int
zenlevel: int
zenprogress: int
zenlevel: int | None = None
zenprogress: int | None = None
level: int
combo: int
currentcombopower: int | None = None
Expand Down
17 changes: 16 additions & 1 deletion tests/tetrio/test_bind.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
from nonebot.adapters.onebot.v11 import Message
from nonebot import get_adapter
from nonebot.adapters.onebot.v11 import Adapter, Bot, Message
from nonebug import App # type: ignore[import-untyped]

from tests.fake_event import FakeGroupMessageEvent
Expand All @@ -17,3 +18,17 @@ async def test_invalid_name(app: App) -> None:
ctx.receive_event(bot, event)
ctx.should_finished(alc)
ctx.should_call_send(event, '用户名/ID不合法', result=None)


@pytest.mark.asyncio
async def test_name(app: App) -> None:
from nonebot_plugin_tetris_stats.games import alc

raw_message = 'tstats io bind scdhh'
message = Message(raw_message)
event = FakeGroupMessageEvent(message=message, original_message=message, raw_message=raw_message)
async with app.test_matcher(alc) as ctx:
bot = ctx.create_bot(base=Bot, adapter=get_adapter(Adapter))
ctx.receive_event(bot, event)
ctx.should_finished(alc)
ctx.should_call_send(event, '绑定成功', result=None)

0 comments on commit 66e44d2

Please sign in to comment.