model: TroCandidate statt OpenPoint, tro_overrides nutzt model-Klassen (Schema v3)

- OpenPoint -> model.TroCandidate (type, position, belongsTo, note);
  TroDocument.candidates ersetzt openPoints, Schema sps_skel-tro-v3
- Positionsbehandlung von TroBase und TroCandidate im Mixin _Positioned
- tro_overrides.py: eigene ConnectionSpec/OpenPoint entfallen, stattdessen
  model.Connection / model.TroCandidate; einheitliche Feldnamen
  (tro_id/separator, hosts als Liste)
- Fixtures, Beispiel-JSON und Doku auf v3 nachgezogen

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Michael Stangl
2026-10-10 11:31:05 +02:00
co-authored by Claude Opus 5.5
parent de8ecb9460
commit 29077caa81
10 changed files with 153 additions and 134 deletions
+13 -2
View File
@@ -6,7 +6,7 @@ import json
import pytest
from pydantic import ValidationError
from model import SCHEMA, Analysis, Connection, DerivedTro, TroDocument
from model import SCHEMA, Analysis, Connection, DerivedTro, TroCandidate, TroDocument
from scl_skeleton import render
@@ -64,7 +64,18 @@ def test_json_uses_tro_json_keys(document):
assert first["items"] == {"Separator": 1, "Switch": 1}
assert first["position"] == {"x": 1030.0, "y": 4700.0, "z": 1500.0}
assert data["connections"][1] == {"from": "TRO01", "to": "TRO02", "kind": "weiche"}
assert "openPoints" in data
assert data["candidates"] == []
def test_candidate_round_trip():
candidate = TroCandidate(name="Qualitaetskontrolle", type_name="1Sep1Swi",
position=(-1026.0, 5250.05, 1478.5), belongs_to="TRO09")
data = json.loads(candidate.model_dump_json(by_alias=True))
assert data["type"] == "1Sep1Swi"
assert data["position"] == {"x": -1026.0, "y": 5250.05, "z": 1478.5}
assert data["belongsTo"] == "TRO09"
assert TroCandidate.model_validate(data) == candidate
assert candidate.describe_position() == "-1026, 5250"
def test_items_and_fb_block_follow_the_type():