update
This commit is contained in:
@@ -333,22 +333,6 @@ def test_stil_kein_fehlalarm_deutsch():
|
||||
assert not any("englische Passage" in x for x in guide._stil_auftraege(text, "Langtext"))
|
||||
|
||||
|
||||
def test_pruefe_dich_norm_match():
|
||||
"""Frage-Matching ist Case/Whitespace-tolerant (Fix darf umformatieren)."""
|
||||
import db
|
||||
import guide
|
||||
from conftest import topic_anlegen
|
||||
topic = topic_anlegen("pruefe")
|
||||
ziel = db.insert("lernziele", topic=topic, text="Z", status="aktiv")
|
||||
b_id = db.insert("bausteine", topic=topic, ziel_id=ziel, titel="B", ord=0, status="neu")
|
||||
a = db.insert("atome", topic=topic, titel="A", typ="begriff", definition="d",
|
||||
status="neu", baustein_id=b_id, braucht=db.j([]))
|
||||
db.insert("artefakte", atom_id=a, typ="flashcard", status="verifiziert",
|
||||
inhalt=db.j({"frage": "Was ist ein Graph?", "antwort": "Knoten und Kanten."}))
|
||||
fragen = guide._pruefe_dich(b_id, "Prüfe dich: Was ist ein Graph?")
|
||||
assert len(fragen) == 1 and fragen[0]["antwort"] == "Knoten und Kanten."
|
||||
|
||||
|
||||
def test_katex_gate_und_markdown_hygiene(monkeypatch):
|
||||
import guide
|
||||
monkeypatch.delenv("CREATOR_FAKE_AGENTS", raising=False) # Gate echt laufen lassen
|
||||
@@ -365,3 +349,42 @@ def test_katex_gate_und_markdown_hygiene(monkeypatch):
|
||||
assert "literales" in auftraege
|
||||
lang_formel = "Es gilt $" + "x + ".join(["y"] * 30) + "$ hier."
|
||||
assert "überlange Inline-Formel" in " ".join(guide._mathe_auftraege(lang_formel, "T"))
|
||||
|
||||
|
||||
def test_split_writer_delimited_und_fallback():
|
||||
import guide
|
||||
# delimited: roher LaTeX-Backslash bleibt (kein JSON-Escaping)
|
||||
k, l = guide._split_writer("===LANG===\nText $a \\leq b$\n===KOMPAKT===\n- p")
|
||||
assert l == "Text $a \\leq b$" and k == "- p"
|
||||
# umgekehrte Reihenfolge der Blöcke
|
||||
k2, l2 = guide._split_writer("===KOMPAKT===\n- x\n===LANG===\nY")
|
||||
assert l2 == "Y" and k2 == "- x"
|
||||
# Fallback: altes JSON
|
||||
k3, l3 = guide._split_writer('{"kompakt": "- a", "lang": "b"}')
|
||||
assert l3 == "b" and k3 == "- a"
|
||||
# Fallback: nackter Text → alles lang
|
||||
assert guide._split_writer("nur text")[1] == "nur text"
|
||||
|
||||
|
||||
async def test_fix_cap_friert_section_ein(monkeypatch):
|
||||
"""Nach FIX_MAX_VERSUCHE erfolglosen Fixes (Text unverändert) wird die Section
|
||||
für Stil-Befunde eingefroren → reparieren meldet bewegt=False (Stillstand)."""
|
||||
import db
|
||||
import fake_agents
|
||||
import guide
|
||||
import llm
|
||||
from conftest import run_anlegen, topic_anlegen
|
||||
topic = topic_anlegen("fixcap")
|
||||
run = run_anlegen(topic)
|
||||
ziel = db.insert("lernziele", topic=topic, text="Kann X", status="aktiv")
|
||||
b = db.insert("bausteine", topic=topic, ziel_id=ziel, titel="B", ord=0, status="neu")
|
||||
a = db.insert("atome", topic=topic, titel="A", typ="begriff", definition="d",
|
||||
status="neu", baustein_id=b, braucht=db.j([]))
|
||||
lang = f"<!-- atom: {a} | A -->\n" + "Wort " * 60
|
||||
db.insert("sections", baustein_id=b, stage="fix", text_lang=lang, text_kompakt="- p",
|
||||
befunde=db.j([]), fix_versuche=guide.FIX_MAX_VERSUCHE) # schon am Cap
|
||||
ctx = llm.Kontext(run, topic, "minimax")
|
||||
ctx.ebene = "guide"
|
||||
bewegt = await guide.reparieren(
|
||||
ctx, [{"art": "det_check", "item": str(b), "detail": "Kürzen"}])
|
||||
assert bewegt is False # eingefroren → nicht geroutet → kein Fortschritt
|
||||
|
||||
Reference in New Issue
Block a user