Kreisel Script-Funktionen und flaches JSON-Testformat

- kreisel-insert-script und kreisel-connect-script in KreiselInsert.lsp
  fuer nicht-interaktives Einfuegen (Tests, Automatisierung)
- kreisel_tests.json von verschachteltem auf flaches JSON-Array umgestellt
  (kompatibel mit omni:load-json)
- test_kreisel.py an neues JSON-Format angepasst (direkte Felder statt
  nested expect/attributes)
- conftest.py: Leere kreisel_results.json wird jetzt korrekt uebersprungen

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-18 16:05:40 +02:00
parent fc38d4740f
commit bd053d76d3
5 changed files with 181 additions and 137 deletions
+13 -9
View File
@@ -21,7 +21,7 @@ class TestKreiselAttributes:
def test_all_tests_executed(self, kreisel_testdata, kreisel_results):
"""Alle definierten Testfaelle muessen ausgefuehrt worden sein."""
expected_ids = {t["id"] for t in kreisel_testdata["tests"]}
expected_ids = {t["id"] for t in kreisel_testdata}
result_ids = {r["test_id"] for r in kreisel_results}
missing = expected_ids - result_ids
assert not missing, f"Nicht ausgefuehrte Tests: {missing}"
@@ -35,23 +35,27 @@ class TestKreiselAttributes:
def test_attributes_match(self, kreisel_testdata, kreisel_results):
"""Erwartete Attribute muessen mit tatsaechlichen uebereinstimmen."""
results_by_id = {r["test_id"]: r for r in kreisel_results}
for test in kreisel_testdata["tests"]:
for test in kreisel_testdata:
result = results_by_id.get(test["id"])
if not result:
continue
for attr, expected in test["expect"]["attributes"].items():
actual = result["actual_attributes"].get(attr)
assert actual == expected, \
f'{test["id"]}: {attr} erwartet="{expected}", ist="{actual}"'
if "expect_kreiselart" in test:
actual = result["actual_attributes"].get("KREISELART")
assert actual == test["expect_kreiselart"], \
f'{test["id"]}: KREISELART erwartet="{test["expect_kreiselart"]}", ist="{actual}"'
if "expect_hoehe" in test:
actual = result["actual_attributes"].get("HOEHE")
assert actual == test["expect_hoehe"], \
f'{test["id"]}: HOEHE erwartet="{test["expect_hoehe"]}", ist="{actual}"'
def test_block_prefix(self, kreisel_testdata, kreisel_results):
"""Block-Namen muessen mit erwartetem Praefix beginnen."""
results_by_id = {r["test_id"]: r for r in kreisel_results}
for test in kreisel_testdata["tests"]:
for test in kreisel_testdata:
result = results_by_id.get(test["id"])
if not result:
continue
prefix = test["expect"]["block_prefix"]
prefix = test.get("expect_block_prefix", "KREISEL_")
assert result["block_name"].startswith(prefix), \
f'{test["id"]}: Block "{result["block_name"]}" beginnt nicht mit "{prefix}"'
@@ -77,7 +81,7 @@ class TestKreiselGeometry:
msp = kreisel_dxf.modelspace()
kr_inserts = [e for e in msp if e.dxftype() == "INSERT"
and e.dxf.name.startswith("KR_")]
expected_count = len(kreisel_testdata["tests"])
expected_count = len(kreisel_testdata)
assert len(kr_inserts) >= expected_count, \
f"Erwartet mind. {expected_count} KR_-Bloecke, gefunden: {len(kr_inserts)}"