style: apply ruff format and fix lint issues in playoff modules
CI / Lint (push) Successful in 8s
CI / Test (push) Successful in 10s
CI / Build & Push (push) Successful in 22s

- Rename single-letter `l` loop variables in bracket_view to satisfy E741
- Drop unused `json` import from test_playoff_cache (F401/F811)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-19 12:48:42 -04:00
parent ebe770fecd
commit 930247b32f
8 changed files with 65 additions and 32 deletions
+8 -4
View File
@@ -1,4 +1,3 @@
import json
import time
from datetime import datetime
from zoneinfo import ZoneInfo
@@ -29,6 +28,7 @@ class _Resp:
def raise_for_status(self):
if self.status_code >= 400:
import requests
raise requests.HTTPError(f"HTTP {self.status_code}")
@@ -65,8 +65,10 @@ class TestBracket:
def test_refresh_failure_returns_none(self, tmp_db, monkeypatch):
import requests
def raiser(*a, **kw):
raise requests.ConnectionError("boom")
monkeypatch.setattr("app.playoff_cache.requests.get", raiser)
assert playoff_cache.refresh_bracket(2026) is None
@@ -94,12 +96,14 @@ class TestFetchSeries:
def should_not_be_called(*a, **kw):
raise AssertionError("network should not be called within TTL")
monkeypatch.setattr("app.playoff_cache.requests.get", should_not_be_called)
assert playoff_cache.fetch_series("2026-A") == payload_cached
def test_stale_cache_falls_back_on_failure(self, tmp_db, monkeypatch):
import requests
key = playoff_cache.series_key("20252026", "A")
playoff_cache._put(key, {"from": "stale"})
@@ -114,12 +118,14 @@ class TestFetchSeries:
def raiser(*a, **kw):
raise requests.ConnectionError("network gone")
monkeypatch.setattr("app.playoff_cache.requests.get", raiser)
assert playoff_cache.fetch_series("2026-A") == {"from": "stale"}
def test_ancient_stale_cache_returns_none(self, tmp_db, monkeypatch):
import requests
key = playoff_cache.series_key("20252026", "A")
playoff_cache._put(key, {"from": "ancient"})
@@ -146,9 +152,7 @@ class TestRecordStartDate:
def test_records_on_first_playoff_sighting(self, tmp_db):
now = datetime(2026, 4, 18, 20, 0, tzinfo=EASTERN)
result = playoff_cache.record_start_date_if_missing(
[{"gameType": 3}], now=now
)
result = playoff_cache.record_start_date_if_missing([{"gameType": 3}], now=now)
assert result == "2026-04-18"
assert playoff_cache.get_playoff_start_date().isoformat() == "2026-04-18"