mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-11 21:13:55 +01:00
Real one-line docstrings stating what each test pins down. Files that would pass 250 lines moved whole classes into _part2 siblings (sick_panel, earned, poke_server, shutdown_reading, manual_workout_dialog). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWYdwRAtMg7ki6TKxuU
40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
"""Tests for the pure, read-only predicates in _compliance_state.py."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
from screen_locker import _compliance_state
|
|
|
|
if TYPE_CHECKING:
|
|
from pathlib import Path
|
|
|
|
|
|
class TestEarlyBirdWindowIsTheCarrot:
|
|
"""The window is whatever wake-alarm's signed file says -- no wall clock."""
|
|
|
|
def test_no_clock_predicate_remains(self) -> None:
|
|
"""The wall-clock early-bird window predicate no longer exists."""
|
|
assert not hasattr(_compliance_state, "_early_bird_window_open")
|
|
|
|
def test_window_open_mirrors_wake_skip(self, tmp_path: Path) -> None:
|
|
"""The early-bird decision follows wake_skip: true skips, false would lock."""
|
|
files = {
|
|
"log_file": tmp_path / "log.json",
|
|
"early_bird_pending_file": tmp_path / "eb.json",
|
|
}
|
|
open_ = _compliance_state.explain_lock_decision(
|
|
**files,
|
|
weekly_minimum_met=False,
|
|
relaxed_day=False,
|
|
wake_skip=True,
|
|
)
|
|
shut = _compliance_state.explain_lock_decision(
|
|
**files,
|
|
weekly_minimum_met=False,
|
|
relaxed_day=False,
|
|
wake_skip=False,
|
|
)
|
|
assert open_.stage == "wake_alarm_skip"
|
|
assert shut.stage == "would_lock"
|