Omniflo-Testsuite hinzugefuegt (Python + AutoLISP)
tests/test_omniflo.py (350 Zeilen):
Python-Tests fuer den Omniflo Bogen/Weiche Export. Testet:
- Unit-Tests fuer build_bogen_merkmale / build_weiche_merkmale gegen
Testdefinitionen aus omniflo_tests.json (kein BricsCAD erforderlich)
- Merkmale-Werte gegen den JSON-Katalog (omniflo_boegen/weichen.json)
- Korrekte Anzahl und Reihenfolge der Elemente in process_blocks()
- CSV-Ausgabeformat (Header, Spaltenanzahl, Merkmale als JSON)
- Integrationstest: liest eine tatsaechliche CSV aus einem BricsCAD-
Lauf (falls DXFM_TESTOUT gesetzt und Datei vorhanden)
Importiert direkt aus lib/export_csv.py (build_lookup, process_blocks,
build_bogen_merkmale, build_weiche_merkmale, load_json).
tests/test_omniflo.lsp (173 Zeilen):
AutoLISP-Tests fuer omni:insert-bogen und omni:insert-weiche.
Prueft Block-Einfuegung, Attribut-Setzung (HOEHE, DREHUNG, ARTINR)
und Fehlerverhalten bei ungueltigen Parametern. Laeuft direkt in
BricsCAD via (load "tests/test_omniflo.lsp").
tests/testdata/omniflo_tests.json (114 Zeilen):
Testdaten fuer test_omniflo.py: Definiert Testfaelle fuer Boegen
(je Winkel: 22.5, 45, 67.5, 90, 180) und Weichen (90°, 45°, koerper,
parallel) mit erwarteten Merkmale-Feldern und Beispiel-SivasNr.
tests/conftest.py:
Pytest-Fixtures fuer den Testlauf: data_dir, testdata_dir,
output_dir und omniflo_lookup (laedt Katalog-JSON falls vorhanden,
sonst leeres Dict als Fallback).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,34 @@ def _load_json(path):
|
||||
return json.load(f)
|
||||
|
||||
|
||||
# --- Omniflo Fixtures ---
|
||||
|
||||
@pytest.fixture
|
||||
def omniflo_testdata():
|
||||
"""Laedt die Omniflo-Testdefinitionen aus testdata/omniflo_tests.json."""
|
||||
path = os.path.join(_testdata_dir(), "omniflo_tests.json")
|
||||
return _load_json(path)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def omniflo_csv():
|
||||
"""Laedt den Inhalt der omniflo_export.csv aus output/."""
|
||||
import csv as _csv
|
||||
path = os.path.join(_output_dir(), "omniflo_export.csv")
|
||||
if not os.path.exists(path):
|
||||
pytest.skip(
|
||||
"omniflo_export.csv nicht vorhanden - "
|
||||
"TEST_OMNIFLO_EXPORT in BricsCAD ausfuehren"
|
||||
)
|
||||
rows = []
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
reader = _csv.reader(f, delimiter=";")
|
||||
header = next(reader)
|
||||
for row in reader:
|
||||
rows.append(row)
|
||||
return {"header": header, "rows": rows}
|
||||
|
||||
|
||||
# --- Kreisel Fixtures ---
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
Reference in New Issue
Block a user