mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-26 15:57:13 +01:00
Drop credit-time asserts from unlock tests
Two more callers asserted the at= anchor the late-credit rule needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWWLoUxxSPf1m8KUVo8
This commit is contained in:
parent
67a54ba89d
commit
7bfd19edae
@ -2,14 +2,12 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import date, datetime, time
|
|
||||||
import pathlib
|
import pathlib
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from screen_locker._day import today_str
|
|
||||||
from screen_locker._log_mixin import RecordResult
|
from screen_locker._log_mixin import RecordResult
|
||||||
from screen_locker.tests.conftest import create_locker
|
from screen_locker.tests.conftest import create_locker
|
||||||
|
|
||||||
@ -28,13 +26,6 @@ if TYPE_CHECKING:
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
def _today_at(hhmm: str) -> float:
|
|
||||||
"""Unix time of ``hhmm`` local on the locker's today."""
|
|
||||||
hours, minutes = (int(p) for p in hhmm.split(":"))
|
|
||||||
day = date.fromisoformat(today_str())
|
|
||||||
return datetime.combine(day, time(hours, minutes)).astimezone().timestamp()
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("pre_ladder")
|
@pytest.mark.usefixtures("pre_ladder")
|
||||||
class TestApplyWorkoutCredit:
|
class TestApplyWorkoutCredit:
|
||||||
"""Tests for ScreenLocker._apply_workout_credit under the multi-per-day rule.
|
"""Tests for ScreenLocker._apply_workout_credit under the multi-per-day rule.
|
||||||
@ -129,9 +120,7 @@ class TestApplyWorkoutCredit:
|
|||||||
assert result.shutdown_adjusted is False
|
assert result.shutdown_adjusted is False
|
||||||
assert result.extra_bonus_delta == 60
|
assert result.extra_bonus_delta == 60
|
||||||
locker._try_adjust_shutdown_for_workout.assert_not_called()
|
locker._try_adjust_shutdown_for_workout.assert_not_called()
|
||||||
locker._adjust_shutdown_time_by.assert_called_once_with(
|
locker._adjust_shutdown_time_by.assert_called_once_with(60)
|
||||||
60, at=_today_at("17:00")
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_additional_verified_workout_earns_plus_one_hour(
|
def test_additional_verified_workout_earns_plus_one_hour(
|
||||||
self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path
|
self, mock_tk: MagicMock, mock_sys_exit: MagicMock, tmp_path: Path
|
||||||
@ -172,4 +161,4 @@ class TestApplyWorkoutCredit:
|
|||||||
assert result.shutdown_adjusted is False
|
assert result.shutdown_adjusted is False
|
||||||
assert result.extra_bonus_delta == 60
|
assert result.extra_bonus_delta == 60
|
||||||
locker._try_adjust_shutdown_for_workout.assert_not_called()
|
locker._try_adjust_shutdown_for_workout.assert_not_called()
|
||||||
locker._adjust_shutdown_time_by.assert_called_once_with(60, at=None)
|
locker._adjust_shutdown_time_by.assert_called_once_with(60)
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class TestUnlockScreenExtras:
|
|||||||
):
|
):
|
||||||
locker.unlock_screen()
|
locker.unlock_screen()
|
||||||
|
|
||||||
locker._adjust_shutdown_time_by.assert_called_once_with(60, at=None)
|
locker._adjust_shutdown_time_by.assert_called_once_with(60)
|
||||||
|
|
||||||
def test_extra_bonus_delta_displayed(
|
def test_extra_bonus_delta_displayed(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user