fix: 进度连续五分钟不动就放弃这门课

This commit is contained in:
2026-11-16 02:51:52 +08:00
parent 7782bba8d8
commit 1da76931f8
2 changed files with 36 additions and 0 deletions
+13
View File
@@ -23,6 +23,7 @@ from euniv.autostudy import (
_play_path,
_set_user_status,
_set_worker_status,
_Stall,
_study_document,
_study_video,
autostudy_status,
@@ -121,6 +122,18 @@ def test_wait_stop_timeout_and_event() -> None:
asyncio.run(main())
def test_stall_gives_up_after_five_minutes_without_progress() -> None:
stall = _Stall()
assert stall.stuck(10, 120) is False
assert stall.stuck(10, 120) is False
assert stall.stuck(10, 120) is True
moved = _Stall()
assert moved.stuck(10, 120) is False
assert moved.stuck(40, 200) is False
assert moved.stuck(40, 99) is False
assert moved.stuck(40, 1) is True
def test_jitter_never_sends_early() -> None:
assert _jitter(0) == 1
assert _jitter(-1) == 1