This commit is contained in:
team3
2026-07-12 16:13:50 +02:00
parent a284e03225
commit 31a42bbf1d
48 changed files with 3625 additions and 253 deletions

View File

@@ -49,3 +49,26 @@ async def test_export_import_roundtrip():
for feld in ("text_lang", "text_kompakt"):
for m in re.findall(r"<!--\s*atom:\s*(\d+)\s*\|", s[feld] or ""):
assert int(m) in atom_ids, f"toter Marker {m}"
async def test_import_remappt_befunde_atom_ids():
"""Offene Fix-Aufträge nennen Atom-IDs im Klartext — nach Import müssen sie
auf die neu vergebenen IDs zeigen, nicht auf tote."""
topic = topic_anlegen("befunde-remap", art="thema")
pipeline.lauf_starten(topic)
await pipeline._laeufe[topic]
b = db.one("SELECT * FROM bausteine WHERE topic=? LIMIT 1", (topic,))
a = db.one("SELECT id FROM atome WHERE baustein_id=?", (b["id"],))
db.update("sections", "baustein_id", b["id"],
befunde=db.j([f"KRITISCH: Marker für Atom {a['id']} fehlt — exakt einfügen."]))
d = json.loads(json.dumps(transfer.export(topic)))
transfer.importieren(d)
atom_ids = {r["id"] for r in db.query("SELECT id FROM atome WHERE topic=?", (topic,))}
treffer = 0
for s in db.query("SELECT s.befunde FROM sections s JOIN bausteine b ON b.id=s.baustein_id"
" WHERE b.topic=?", (topic,)):
for auftrag in db.uj(s["befunde"]):
for m in re.findall(r"Atom (\d+)", str(auftrag)):
assert int(m) in atom_ids, f"toter Befund-Marker {m}"
treffer += 1
assert treffer >= 1 # der eingefügte Auftrag wurde geprüft