feat: 管理端定时日扩到1至28号,学时顺带写回列表
This commit is contained in:
@@ -606,8 +606,9 @@ def test_study_window_clamps_day_into_allowed_range() -> None:
|
||||
assert window_open(account, datetime(2026, 2, 8, 15, 59, 59, tzinfo=CN_TZ)) is False
|
||||
assert window_open(account, datetime(2026, 2, 8, 16, 0, 0, tzinfo=CN_TZ)) is True
|
||||
early = _Start(1, 16, 0, 0)
|
||||
assert window_open(early, datetime(2026, 11, 8, 15, 59, 59, tzinfo=CN_TZ)) is False
|
||||
assert window_open(early, datetime(2026, 11, 8, 16, 0, 0, tzinfo=CN_TZ)) is True
|
||||
assert window_open(early, datetime(2026, 11, 1, 15, 59, 59, tzinfo=CN_TZ)) is False
|
||||
assert window_open(early, datetime(2026, 11, 1, 16, 0, 0, tzinfo=CN_TZ)) is True
|
||||
assert window_open(early, datetime(2026, 11, 8, 15, 59, 59, tzinfo=CN_TZ)) is True
|
||||
|
||||
|
||||
def test_immediate_start_skips_monthly_window() -> None:
|
||||
@@ -899,6 +900,19 @@ def test_study_window_rejects_invalid_parts() -> None:
|
||||
validate_start(8, 24, 0, 0)
|
||||
assert validate_start(5, 0, 0, 0) == (5, 0, 0, 0)
|
||||
assert validate_start(25, 23, 59, 59) == (25, 23, 59, 59)
|
||||
assert validate_start(1, 0, 0, 0, day_min=1, day_max=28) == (1, 0, 0, 0)
|
||||
assert validate_start(28, 8, 0, 0, day_min=1, day_max=28) == (28, 8, 0, 0)
|
||||
|
||||
|
||||
def test_stored_start_keeps_admin_days_outside_the_user_range() -> None:
|
||||
from types import SimpleNamespace
|
||||
|
||||
from euniv.study_window import stored_start
|
||||
|
||||
early = SimpleNamespace(study_start_day=1, study_start_hour=6, study_start_minute=0, study_start_second=0)
|
||||
late = SimpleNamespace(study_start_day=28, study_start_hour=0, study_start_minute=0, study_start_second=0)
|
||||
assert stored_start(early) == (1, 6, 0, 0)
|
||||
assert stored_start(late) == (28, 0, 0, 0)
|
||||
|
||||
|
||||
def test_course_workers_default_and_range() -> None:
|
||||
|
||||
Reference in New Issue
Block a user