Der Schnitt aus CLAUDE.md ist durchgehalten: - Fetch (deterministisch, kein LLM): marktguru-Adapter mit geprüftem Ortsbezug (zipCode), Wochen-Cache, robots.txt-Respekt, ehrlicher Regel-4- Abbruch bei fehlendem Beleg statt Krücke. - Kategorisierung (einziger LLM-Ort): geschlossene Liste + Daten-Integrität als Code erzwungen; austauschbar via Protokoll (OpenRouter/Anthropic), mit Drosselung/Retry und ehrlichem Abbruch. - FastAPI-Web-UI als dünne Schicht: Modellauswahl (Liste/Suche/Refresh), Live-Fortschritt, gruppierte Ergebnisse mit Filtern, Ergebnis-Cache. - 36 Tests gegen die Architektur-Regeln (kein Auffüllen, Abbruch, Integrität, geschlossene Liste, Unsicherheit, Schnitt) und die Web-Schicht. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
"""Der Schnitt als Test: im Fetch-Teil darf KEIN LLM geladen werden.
|
|
|
|
Geprüft in einem frischen Interpreter: nach dem Import des kompletten
|
|
Fetch-Pfads (fetch + marktguru-Adapter) darf 'anthropic' nicht in sys.modules
|
|
stehen. So bleibt die Trennung 'kein LLM im Fetch-Teil' eine prüfbare Bedingung.
|
|
"""
|
|
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
SRC = Path(__file__).resolve().parents[1] / "src"
|
|
|
|
|
|
def test_fetch_teil_laedt_kein_anthropic():
|
|
code = (
|
|
"import sys; "
|
|
"import angebote.fetch; "
|
|
"import angebote.quellen.marktguru; "
|
|
"assert 'anthropic' not in sys.modules, "
|
|
"'Fetch-Teil hat anthropic geladen -- Schnitt verletzt'; "
|
|
"print('ok')"
|
|
)
|
|
proc = subprocess.run(
|
|
[sys.executable, "-c", code],
|
|
cwd=str(SRC),
|
|
capture_output=True,
|
|
text=True,
|
|
)
|
|
assert proc.returncode == 0, proc.stderr
|
|
assert "ok" in proc.stdout
|
|
|
|
|
|
def test_marktguru_quelltext_nennt_anthropic_nicht():
|
|
quelltext = (SRC / "angebote" / "quellen" / "marktguru.py").read_text("utf-8")
|
|
assert "anthropic" not in quelltext.lower()
|