test(#134): report.py Coverage 44.3% → 52.7%

- TestGetScoreColor: alle 5 Branches (>=7 blue, >=4 green, >=2 yellow,
  >=1 orange, sonst red)
- TestGetRatingSymbol: alle 5 Symbole (++, +, ○, −, −−)

Verbleibend (Lines 487-641): WeasyPrint-PDF-Render-Pfade — brauchen
echtes WeasyPrint-Setup, gehoeren in tests/integration/.

Total: 53.2% → 53.4%, 777 → 787 Tests.
This commit is contained in:
Dotty Dotter 2026-04-28 11:13:20 +02:00
parent ccff2e3e8e
commit 16ecd31e50

View File

@ -192,3 +192,53 @@ def test_generate_html_report_escapes_all_llm_payloads(tmp_path: Path):
# Format-Redline-Marker müssen weiterhin funktionieren (Vorschlag mit **) # Format-Redline-Marker müssen weiterhin funktionieren (Vorschlag mit **)
assert '<span class="inserted">' in html assert '<span class="inserted">' in html
# ─── Coverage-Backfill (#134) ────────────────────────────────────────────────
class TestGetScoreColor:
def test_high_score_blue(self):
from app.report import get_score_color
assert get_score_color(8.5).lower().startswith("#")
assert get_score_color(8.5) == get_score_color(7.0) # gleiche Klasse
def test_mid_score_green(self):
from app.report import get_score_color, COLORS
assert get_score_color(5.0) == COLORS["green"]
def test_low_yellow(self):
from app.report import get_score_color
assert get_score_color(2.5) == "#FFC20E"
def test_very_low_orange(self):
from app.report import get_score_color, COLORS
assert get_score_color(1.5) == COLORS["orange"]
def test_zero_red(self):
from app.report import get_score_color, COLORS
assert get_score_color(0.0) == COLORS["red"]
class TestGetRatingSymbol:
def test_strong_positive(self):
from app.report import get_rating_symbol
assert get_rating_symbol(2) == "++"
assert get_rating_symbol(5) == "++"
def test_positive(self):
from app.report import get_rating_symbol
assert get_rating_symbol(1) == "+"
def test_neutral(self):
from app.report import get_rating_symbol
assert get_rating_symbol(0) == ""
def test_negative(self):
from app.report import get_rating_symbol
assert get_rating_symbol(-1) == ""
def test_strong_negative(self):
from app.report import get_rating_symbol
assert get_rating_symbol(-2) == ""
assert get_rating_symbol(-5) == ""