fix(lint): improved type checking and code maintainability

This commit is contained in:
matt 2025-10-31 10:11:00 -07:00
parent 83fe527979
commit 40023e93b8
62 changed files with 187 additions and 197 deletions

View file

@ -1,6 +1,6 @@
import os
from code.web.services.theme_preview import get_theme_preview, bust_preview_cache # type: ignore
from code.web.services import preview_cache as pc # type: ignore
from code.web.services.theme_preview import get_theme_preview, bust_preview_cache
from code.web.services import preview_cache as pc
def test_basic_low_score_eviction(monkeypatch):
@ -17,7 +17,7 @@ def test_basic_low_score_eviction(monkeypatch):
get_theme_preview('Blink', limit=6, colors=c)
# Cache limit 5, inserted 6 distinct -> eviction should have occurred
assert len(pc.PREVIEW_CACHE) <= 5
from code.web.services.preview_metrics import preview_metrics # type: ignore
from code.web.services.preview_metrics import preview_metrics
m = preview_metrics()
assert m['preview_cache_evictions'] >= 1, 'Expected at least one eviction'
assert m['preview_cache_evictions_by_reason'].get('low_score', 0) >= 1