update
This commit is contained in:
@@ -10,18 +10,18 @@ from conftest import run_anlegen, topic_anlegen
|
||||
def test_merge_kollision_und_kette():
|
||||
topic = topic_anlegen("mergekante")
|
||||
a = db.insert("atome", topic=topic, titel="A", typ="begriff", definition="lang genug",
|
||||
status="neu", braucht=db.j([]))
|
||||
status="neu")
|
||||
b = db.insert("atome", topic=topic, titel="B", typ="begriff", definition="kurz",
|
||||
status="neu", braucht=db.j([]))
|
||||
status="neu")
|
||||
c = db.insert("atome", topic=topic, titel="C", typ="begriff", definition="x",
|
||||
status="neu", braucht=db.j([]))
|
||||
status="neu")
|
||||
# beide haben dieselbe Kante zu C → blindes Umhängen würde UNIQUE verletzen
|
||||
db.execute("INSERT INTO kanten(topic, von_atom, zu_atom, art) VALUES(?,?,?,'braucht')",
|
||||
db.execute("INSERT INTO kanten(topic, von_atom, zu_atom, art) VALUES(?,?,?,'verwandt')",
|
||||
(topic, a, c))
|
||||
db.execute("INSERT INTO kanten(topic, von_atom, zu_atom, art) VALUES(?,?,?,'braucht')",
|
||||
db.execute("INSERT INTO kanten(topic, von_atom, zu_atom, art) VALUES(?,?,?,'verwandt')",
|
||||
(topic, b, c))
|
||||
# und eine Kante zwischen den Merge-Partnern → würde Selbstkante
|
||||
db.execute("INSERT INTO kanten(topic, von_atom, zu_atom, art) VALUES(?,?,?,'braucht')",
|
||||
db.execute("INSERT INTO kanten(topic, von_atom, zu_atom, art) VALUES(?,?,?,'verwandt')",
|
||||
(topic, b, a))
|
||||
inventar._merge(topic, a, b)
|
||||
kanten = db.query("SELECT * FROM kanten WHERE topic=?", (topic,))
|
||||
@@ -39,7 +39,7 @@ async def test_anker_rematch_ohne_llm(tmp_path):
|
||||
q = db.insert("quellen", topic=topic, art="datei", titel="q",
|
||||
snapshot=str(snap), hash="h", status="atome")
|
||||
a = db.insert("atome", topic=topic, titel="T", typ="begriff", definition="d",
|
||||
status="ohne_anker", braucht=db.j([]))
|
||||
status="ohne_anker")
|
||||
# Extraktion fand das Zitat nicht (Whitespace-Differenz), hat es aber gespeichert
|
||||
db.insert("anker", atom_id=a, quelle_id=q, start=-1, ende=-1,
|
||||
zitat="Der Satz steht hier drin.")
|
||||
@@ -67,7 +67,7 @@ async def test_resume_liest_teilextrahierte_quelle_weiter(tmp_path):
|
||||
q = db.insert("quellen", topic=topic, art="datei", titel="q",
|
||||
snapshot=str(snap), hash="h", status="extrahiert", atome_stand="")
|
||||
a = db.insert("atome", topic=topic, titel="Alt", typ="begriff", definition="d",
|
||||
status="neu", braucht=db.j([]))
|
||||
status="neu")
|
||||
db.insert("anker", atom_id=a, quelle_id=q, start=0, ende=5, zitat="Absatz")
|
||||
ctx = llm.Kontext(run, topic, "minimax")
|
||||
ctx.ebene = "inventar"
|
||||
@@ -94,7 +94,7 @@ async def test_stichentscheid_braucht_zwei_stimmen(monkeypatch):
|
||||
|
||||
def neu_atom():
|
||||
return db.insert("atome", topic=topic, titel="X", typ="begriff",
|
||||
definition="d", status="neu", braucht=db.j([]))
|
||||
definition="d", status="neu")
|
||||
|
||||
def panel_mit(votes):
|
||||
async def _p(ctx, groesse, **kw):
|
||||
@@ -127,7 +127,7 @@ async def test_anker_batch_ausfall_verwirft_nicht(monkeypatch, tmp_path):
|
||||
q = db.insert("quellen", topic=topic, art="datei", titel="q",
|
||||
snapshot=str(snap), hash="h", status="atome")
|
||||
a = db.insert("atome", topic=topic, titel="T", typ="begriff", definition="d",
|
||||
status="ohne_anker", braucht=db.j([]))
|
||||
status="ohne_anker")
|
||||
db.insert("anker", atom_id=a, quelle_id=q, start=-1, ende=-1,
|
||||
zitat="Ein Zitat das nirgends im Quelltext steht und lang genug ist.")
|
||||
monkeypatch.setitem(fake_agents._HANDLER, "Atom-Anker-Fix-Batch", lambda p: {})
|
||||
@@ -174,14 +174,20 @@ async def test_titel_dublette_wird_gemerged_trotz_ferner_definition():
|
||||
a = db.insert("atome", topic=topic, titel="VERTEX COVER Problem", typ="begriff",
|
||||
definition="Entscheidungsproblem, ob ein Graph ein Vertex Cover"
|
||||
" der Größe höchstens k enthält.",
|
||||
status="neu", braucht=db.j([]))
|
||||
status="neu")
|
||||
b = db.insert("atome", topic=topic, titel="VERTEX COVER Problem", typ="begriff",
|
||||
definition="Gefragt wird nach einer Knotenmenge, die jede Kante"
|
||||
" abdeckt und maximal k Elemente hat.",
|
||||
status="neu", braucht=db.j([]))
|
||||
status="neu")
|
||||
ctx = llm.Kontext(run, topic, "minimax")
|
||||
ctx.ebene = "inventar"
|
||||
await inventar._judge_dedup(ctx)
|
||||
stati = {r["id"]: r["status"] for r in db.query(
|
||||
"SELECT id, status FROM atome WHERE topic=?", (topic,))}
|
||||
assert sorted(stati.values()) == ["gemerged", "neu"]
|
||||
|
||||
|
||||
def test_titel_kaputt_flaggt_latex():
|
||||
assert inventar._titel_kaputt("Variablen in $\\alpha_k$")
|
||||
assert inventar._titel_kaputt("Der \\textsc{VC}-Beweis")
|
||||
assert not inventar._titel_kaputt("Vertex Cover und Entscheidungsvariante")
|
||||
|
||||
Reference in New Issue
Block a user