feat: 定时开始日改为每月5到25号,默认8号
This commit is contained in:
@@ -406,15 +406,18 @@ def test_study_window_opens_after_configured_time() -> None:
|
||||
assert window_open(account, datetime(2026, 12, 5, 15, 0, 0, tzinfo=CN_TZ)) is False
|
||||
|
||||
|
||||
def test_study_window_clamps_missing_day() -> None:
|
||||
def test_study_window_clamps_day_into_allowed_range() -> None:
|
||||
account = _Start(31, 16, 0, 0)
|
||||
assert window_open(account, datetime(2026, 2, 28, 15, 59, 59, tzinfo=CN_TZ)) is False
|
||||
assert window_open(account, datetime(2026, 2, 28, 16, 0, 0, tzinfo=CN_TZ)) is True
|
||||
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
|
||||
|
||||
|
||||
def test_immediate_start_skips_monthly_window() -> None:
|
||||
frozen = datetime(2026, 11, 15, 12, 0, tzinfo=CN_TZ)
|
||||
account = _Start(28, 23, 59, 59)
|
||||
account = _Start(25, 23, 59, 59)
|
||||
assert study_eligible(account, frozen) is False
|
||||
start_now(account)
|
||||
assert account.study_paused is False
|
||||
@@ -461,22 +464,22 @@ def test_hours_met_clears_started_without_pause() -> None:
|
||||
|
||||
|
||||
def test_stop_this_month_does_not_block_next_month_schedule() -> None:
|
||||
account = _Start(1, 0, 0, 0)
|
||||
account = _Start(5, 0, 0, 0)
|
||||
start_now(account)
|
||||
stop_now(account, datetime(2026, 11, 15, 12, 0, tzinfo=CN_TZ))
|
||||
assert study_eligible(account, datetime(2026, 11, 20, 8, 0, tzinfo=CN_TZ)) is False
|
||||
assert study_view(account, datetime(2026, 12, 1, 0, 0, tzinfo=CN_TZ))["paused"] is False
|
||||
assert study_eligible(account, datetime(2026, 12, 1, 0, 0, tzinfo=CN_TZ)) is True
|
||||
assert study_view(account, datetime(2026, 12, 5, 0, 0, tzinfo=CN_TZ))["paused"] is False
|
||||
assert study_eligible(account, datetime(2026, 12, 5, 0, 0, tzinfo=CN_TZ)) is True
|
||||
|
||||
|
||||
def test_stale_month_hours_do_not_block_next_month() -> None:
|
||||
account = _Start(1, 0, 0, 0)
|
||||
account = _Start(5, 0, 0, 0)
|
||||
account.monthly_target = 70
|
||||
account.month_hours = "78"
|
||||
account.hours_month = "2026-11"
|
||||
assert hours_met(account, datetime(2026, 11, 20, tzinfo=CN_TZ)) is True
|
||||
assert hours_met(account, datetime(2026, 12, 1, tzinfo=CN_TZ)) is False
|
||||
assert study_eligible(account, datetime(2026, 12, 1, tzinfo=CN_TZ)) is True
|
||||
assert hours_met(account, datetime(2026, 12, 5, tzinfo=CN_TZ)) is False
|
||||
assert study_eligible(account, datetime(2026, 12, 5, tzinfo=CN_TZ)) is True
|
||||
|
||||
|
||||
def test_work_running_is_wanted_or_studying() -> None:
|
||||
@@ -623,9 +626,13 @@ def test_finish_user_keeps_failure_and_clears_idle() -> None:
|
||||
|
||||
def test_study_window_rejects_invalid_parts() -> None:
|
||||
with pytest.raises(StudyWindowError):
|
||||
validate_start(32, 0, 0, 0)
|
||||
validate_start(4, 0, 0, 0)
|
||||
with pytest.raises(StudyWindowError):
|
||||
validate_start(1, 24, 0, 0)
|
||||
validate_start(26, 0, 0, 0)
|
||||
with pytest.raises(StudyWindowError):
|
||||
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)
|
||||
|
||||
|
||||
def test_course_workers_default_and_range() -> None:
|
||||
|
||||
Reference in New Issue
Block a user