fix: 立即开始只在当月有效,密码被拒后不再重试

This commit is contained in:
2026-11-16 02:47:43 +08:00
parent 2ef51591c1
commit 72d2d660b8
3 changed files with 26 additions and 6 deletions
+11
View File
@@ -50,6 +50,7 @@ from euniv.study_control import (
assemble,
eligible as study_eligible,
hours_met,
expire_pause,
start_now,
stop_now,
view_of as study_view,
@@ -413,6 +414,16 @@ def test_immediate_start_skips_monthly_window() -> None:
assert study_eligible(account, datetime(2026, 11, 15, 13, 0, tzinfo=CN_TZ)) is False
def test_manual_start_expires_when_the_month_changes() -> None:
account = _Start(15, 0, 0, 0)
account.study_schedule_enabled = False
start_now(account, datetime(2026, 11, 20, tzinfo=CN_TZ))
assert study_eligible(account, datetime(2026, 11, 21, tzinfo=CN_TZ)) is True
assert expire_pause(account, datetime(2026, 12, 1, tzinfo=CN_TZ)) is True
assert account.study_ignore_window is False
assert study_eligible(account, datetime(2026, 12, 1, tzinfo=CN_TZ)) is False
def test_hours_met_clears_started_without_pause() -> None:
account = _Start(1, 0, 0, 0)
start_now(account)