mirror of
https://github.com/kuhyx/steam-backlog-enforcer.git
synced 2026-11-20 11:52:18 +01:00
Guard test walks every toast call for literal words. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
964 B
Python
34 lines
964 B
Python
"""Tests for _playtime_notify._humanise (kept from test_playtime_procs)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from steam_backlog_enforcer._playtime_notify import _humanise, short_duration
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
("seconds", "shown"),
|
|
[(30, "30s"), (60, "1m"), (300, "5m"), (3600, "1h"), (5400, "1h 30m")],
|
|
)
|
|
def test_short_duration(seconds: int, shown: str) -> None:
|
|
"""Toasts paint a number + unit, never a word."""
|
|
assert short_duration(seconds) == shown
|
|
|
|
|
|
class TestHumanise:
|
|
def test_seconds(self) -> None:
|
|
assert _humanise(30) == "30 seconds"
|
|
|
|
def test_exact_minute_boundary(self) -> None:
|
|
assert _humanise(60) == "1 minutes"
|
|
|
|
def test_minutes(self) -> None:
|
|
assert _humanise(300) == "5 minutes"
|
|
|
|
def test_one_hour_is_special_cased(self) -> None:
|
|
assert _humanise(3600) == "1 hour"
|
|
|
|
def test_thirty_minutes(self) -> None:
|
|
assert _humanise(1800) == "30 minutes"
|