mirror of
https://github.com/kuhyx/steam-backlog-enforcer.git
synced 2026-11-11 14:47:52 +01:00
hltb, _cmd_done, _whitelist and _actions each kept a module __getattr__ that served names moved out in the 250-line split, via importlib to dodge the resulting import cycle. pylint cannot see through that, and graded every such import as no-name-in-module (26 of them). The 32 import statements now name the real module; with nothing left going through the facades, they are gone. Also the pylint hook on 4.0.8 with the source-only scope config, the three implicit-booleaness disables the reference repos carry, the http.server do_GET admission, and the third-party pins the hook was missing (aiohttp, websockets, howlongtobeatpy). Gate still 8.0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HHCbkJWXHjtTUaqvnHRAqA
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
"""Tests for hltb module - part 3 (fetch_hltb_times)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from unittest.mock import patch
|
|
|
|
from steam_backlog_enforcer._hltb_types import HLTBResult
|
|
from steam_backlog_enforcer.hltb import fetch_hltb_times
|
|
|
|
|
|
class TestFetchHltbTimes:
|
|
"""Tests for fetch_hltb_times."""
|
|
|
|
def test_empty(self) -> None:
|
|
assert fetch_hltb_times([]) == []
|
|
|
|
def test_calls_batch(self) -> None:
|
|
mock_result = HLTBResult(
|
|
app_id=440, game_name="TF2", completionist_hours=50.0, similarity=1.0
|
|
)
|
|
with patch(
|
|
"steam_backlog_enforcer.hltb._fetch_batch",
|
|
return_value=[mock_result],
|
|
):
|
|
results = fetch_hltb_times([(440, "TF2")])
|
|
assert len(results) == 1
|
|
|
|
def test_none_cache(self) -> None:
|
|
with patch(
|
|
"steam_backlog_enforcer.hltb._fetch_batch",
|
|
return_value=[],
|
|
):
|
|
results = fetch_hltb_times([(440, "TF2")])
|
|
assert results == []
|
|
|
|
def test_explicit_cache(self) -> None:
|
|
with patch(
|
|
"steam_backlog_enforcer.hltb._fetch_batch",
|
|
return_value=[],
|
|
):
|
|
cache: dict[int, float] = {440: 10.0}
|
|
results = fetch_hltb_times([(440, "TF2")], cache=cache)
|
|
assert results == []
|