mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-10 20:27:13 +01:00
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (push) Waiting to run
Tests / test (push) Waiting to run
Tests / lock-popup-safety (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
05:00-08:30 (09:00 with the extended reward) locked nobody but did hold the workout lock off on a clock that knew nothing about whether the user was up, next to the morning-session rung that did. EarlyBirdMixin._is_early_bird_time is now that rung's verdict: open before the alarm, during the session, and until 11:00 once it completed in time -- exactly what wake-alarm signs. The wake_alarm_skip rung banks the pending marker so the carrot's end still tries a phone/RunnerUp workout before locking; early-bird-workout-check.timer moves to 09:30:30 and 11:00:30, the two possible ends. The consumer's boot-retry window starts at 05:00 with the refresher. Also: the sick screen lists four past justifications, one line each -- six full-length ones pushed it 7 px past 1366x768, which the screens-fit gate only sees with a real history on disk. Takes @types/node 26.6.2, eslint 10.11.0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XTdfXjbGYYrY7Quxcfz6mg
48 lines
1.8 KiB
Python
48 lines
1.8 KiB
Python
"""The early-bird window is the wake-alarm morning-session carrot."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from typing import TYPE_CHECKING
|
|
from unittest.mock import MagicMock, patch
|
|
|
|
from screen_locker._morning_session import MorningSkip
|
|
from screen_locker.tests.conftest import create_locker
|
|
|
|
if TYPE_CHECKING:
|
|
from pathlib import Path
|
|
|
|
_SKIP = MorningSkip(outcome="completed", exempt_until=datetime(2099, 1, 1).astimezone())
|
|
|
|
|
|
class TestIsEarlyBirdTime:
|
|
"""``_is_early_bird_time`` is the carrot verdict, kept for the skip detail."""
|
|
|
|
def test_open_while_the_carrot_is_in_force(
|
|
self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path
|
|
) -> None:
|
|
locker = create_locker(mock_tk, tmp_path)
|
|
with patch(
|
|
"screen_locker._early_bird.morning_skip_today", return_value=_SKIP
|
|
) as read:
|
|
assert locker._is_early_bird_time() is True
|
|
read.assert_called_once_with(wait=True)
|
|
assert locker._morning_skip == _SKIP
|
|
|
|
def test_shut_without_a_carrot(
|
|
self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path
|
|
) -> None:
|
|
locker = create_locker(mock_tk, tmp_path)
|
|
with patch("screen_locker._early_bird.morning_skip_today", return_value=None):
|
|
assert locker._is_early_bird_time() is False
|
|
assert locker._morning_skip is None
|
|
|
|
def test_no_wall_clock_is_consulted(
|
|
self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path
|
|
) -> None:
|
|
"""The 05:00-08:30 clock is gone: 07:00 with a carrot is open, 06:00 without is shut."""
|
|
locker = create_locker(mock_tk, tmp_path)
|
|
assert not hasattr(locker, "_get_local_time_minutes")
|
|
with patch("screen_locker._early_bird.morning_skip_today", return_value=None):
|
|
assert locker._is_early_bird_time() is False
|