focus_project: type-clean tests
Some checks are pending
dependency freshness / dependencies on newest stable (push) Waiting to run
file length / file-length (push) Waiting to run
focus-project pre-commit / pre-commit (push) Waiting to run
focus-project tests / test (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
palette drift / palette (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWXdzckyBH7fEbPywpr
This commit is contained in:
Krzysztof Rudnicki 2026-11-02 10:04:36 +01:00
parent 637428585c
commit 4d75ce6d48
3 changed files with 9 additions and 5 deletions

View File

@ -7,6 +7,7 @@ from datetime import date, timedelta
import json
import logging
from pathlib import Path # noqa: TC003
from typing import Any
import earned_time
import pytest
@ -23,8 +24,11 @@ def _key(tmp_path: Path) -> None:
(tmp_path / "hmac.key").write_bytes(KEY)
def rows() -> list[dict]:
return json.loads(ledger.ledger_path().read_text())["entries"]
def rows() -> list[dict[str, Any]]:
entries: list[dict[str, Any]] = json.loads(ledger.ledger_path().read_text())[
"entries"
]
return entries
def beats(*times: float) -> None:
@ -146,7 +150,7 @@ def test_forged_and_malformed_rows_do_not_count() -> None:
"detail": {**good["detail"], "minutes": 50},
}
other_key = ledger.build_row("hr", D1, 9, 9, b"x" * 32, now=at(9))
junk: list = [
junk: list[Any] = [
"str",
{"kind": "charge"},
{**good, "detail": "no"},

View File

@ -19,7 +19,7 @@ from focus_project.tests.test_minutes import D1, at, project
KEY = b"k" * 32
def ac_row(ts: float, eid: str = "ac:1", key: bytes = KEY) -> dict:
def ac_row(ts: float, eid: str = "ac:1", key: bytes = KEY) -> dict[str, Any]:
row: dict[str, Any] = {
"entry_id": eid,
"kind": "credit",

View File

@ -100,7 +100,7 @@ def test_broken_adapter_import_contributes_zero(
def broken(name: str) -> None:
raise ImportError(name)
monkeypatch.setattr(sources.importlib, "import_module", broken)
monkeypatch.setattr("focus_project.sources.importlib.import_module", broken)
with caplog.at_level(logging.ERROR):
result = sources.collect_by_source(DAY, PROJECT)
assert all(spans == [] for spans in result.values())