update
This commit is contained in:
@@ -178,7 +178,7 @@ def test_det_auftraege_blockquote_und_artefakt():
|
||||
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([]))
|
||||
lang = (f"<!-- atom: {a} | A | E -->\n" + "Fließtext. " * 45
|
||||
lang = (f"<!-- atom: {a} | A -->\n" + "Fließtext. " * 45
|
||||
+ "\n> wörtliches Rohzitat aus der Quelle\nEs gilt u 6= v."
|
||||
+ "\n\nDas Blank-Symbol $[. ist speziell und liegt in $[ \\in \\Gamma$.")
|
||||
kompakt = "- Definition mit x_i und Laufzeit 2^(n/2) als Klartext."
|
||||
@@ -189,6 +189,62 @@ def test_det_auftraege_blockquote_und_artefakt():
|
||||
assert "Kompakt-Fassung" in text and "x_i" in text # Klartext-Formeln gefangen
|
||||
|
||||
|
||||
def test_det_auftraege_neue_checks():
|
||||
import db
|
||||
import guide
|
||||
from conftest import topic_anlegen
|
||||
topic = topic_anlegen("detcheck2")
|
||||
ziel = db.insert("lernziele", topic=topic, text="Kann X", 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([]))
|
||||
wand = "Wort " * 130
|
||||
lang = (f"<!-- atom: {a} | A -->\n<!-- atom: 99999 | Fremd -->\n"
|
||||
"Der Beweis folgt aus Satz 6.25, dazu später mehr.\n\n"
|
||||
+ wand + "\n\n#### Leere Überschrift\n\n#### Noch eine\nText dahinter.\n\n"
|
||||
"The proof is left as an exercise for the reader and this paragraph"
|
||||
" should be detected by the language check here.")
|
||||
kompakt = f"<!-- atom: {a} | A -->\n- Punkt"
|
||||
text = " ".join(guide._det_auftraege(topic, {"id": b_id, "ord": 0}, lang, kompakt))
|
||||
assert "gehört nicht zu diesem Baustein" in text # marker_fremd
|
||||
assert "Vertröstungs-Floskel" in text # „später mehr"
|
||||
assert "Quellen-Referenz" in text # Satz 6.25
|
||||
assert "Wörter (Regel: 40–90)" in text # Absatz-Wand
|
||||
assert "ohne folgenden Text" in text # leere Überschrift
|
||||
assert "englische Passage" in text
|
||||
assert "Marker gehören nur" in text # Marker in Kompakt-Fassung
|
||||
# qa=True: Marker/Länge/Vorwärts haben eigene Befund-Arten, Stil-Checks bleiben
|
||||
qa_text = " ".join(guide._det_auftraege(topic, {"id": b_id, "ord": 0},
|
||||
lang, kompakt, qa=True))
|
||||
assert "gehört nicht zu diesem Baustein" not in qa_text
|
||||
assert "Vertröstungs-Floskel" in qa_text
|
||||
|
||||
|
||||
async def test_fix_fehlschlag_behaelt_befunde(monkeypatch):
|
||||
import db
|
||||
import fake_agents
|
||||
import guide
|
||||
import llm
|
||||
from conftest import run_anlegen, topic_anlegen
|
||||
topic = topic_anlegen("fixfail")
|
||||
run = run_anlegen(topic)
|
||||
ziel = db.insert("lernziele", topic=topic, text="Kann X", status="aktiv")
|
||||
b_id = db.insert("bausteine", topic=topic, ziel_id=ziel, titel="B", ord=0, status="neu")
|
||||
db.insert("atome", topic=topic, titel="A", typ="begriff", definition="d",
|
||||
status="neu", baustein_id=b_id, braucht=db.j([]))
|
||||
db.insert("sections", baustein_id=b_id, stage="fix",
|
||||
text_lang="alt", text_kompakt="", befunde=db.j(["Behebe (x): y"]))
|
||||
# Fix liefert Text OHNE Marker → Marker-Invariante bricht → Fehlschlag-Pfad
|
||||
monkeypatch.setitem(fake_agents._HANDLER, "Guide-Fix",
|
||||
lambda p: {"kompakt": "", "lang": "kein Marker"})
|
||||
ctx = llm.Kontext(run, topic, "minimax")
|
||||
ctx.ebene = "guide"
|
||||
stage = await guide._stage_fix(ctx, db.one("SELECT * FROM bausteine WHERE id=?", (b_id,)))
|
||||
sec = db.one("SELECT * FROM sections WHERE baustein_id=?", (b_id,))
|
||||
assert stage == "done" and sec["text_lang"] == "alt"
|
||||
assert db.uj(sec["befunde"]) == ["Behebe (x): y"] # Aufträge bleiben sichtbar
|
||||
|
||||
|
||||
def test_katex_gate_und_markdown_hygiene(monkeypatch):
|
||||
import guide
|
||||
monkeypatch.delenv("CREATOR_FAKE_AGENTS", raising=False) # Gate echt laufen lassen
|
||||
|
||||
Reference in New Issue
Block a user