feat(python): PEDIT polyline wrappers and path/3-D arrays

polyline_close/open/width/reverse/join (a line or arc is turned into a polyline
first), array_path and array_3d, written against observed prompts and checked
for exact geometry in the real-IPC audit. Polylines default their pick point to
the first vertex. The audit runs on a large-stack thread because PEDIT's
line-to-polyline step needs more than a test thread's 2 MiB in a debug build.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Felix RiestraandClaude Sonnet 5 committed 2026-09-21 17:57:58 +02:00
1 parent 81251d9cf3
commit b180dce1a1
5 files changed
+175 -57

No files matched your search

@@ -58,6 +58,8 @@ class DocumentModelTests(unittest.TestCase):
outcome = {"status": "completed", "blocked_by": None, "command": "", "prompt": "", "accepts": [],
"options": [], "entities": 0, "added": 0, "unconsumed": [], "error": None}
outcome.update(self.step_outcome.get(kind, {}))
if kind == "token" and options.get("text") == "X":
outcome["status"] = "completed"
if kind in ("enter", "entity"):
new = max(self.records) + 1
self.records[new] = {"handle": new, "kind": "Line", "layer": "0", "_editable": True}
@@ -114,6 +116,20 @@ class DocumentModelTests(unittest.TestCase):
self.doc.modify.stretch((0, 0), (1, 1), (0, 0), (5, 0))
self.assertEqual([c[1] for c in self.calls if c[0] == "step"], ["start", "point", "point", "enter", "point", "point"])
def test_pedit_and_array_wrappers(self):
self.step_outcome = {"start": {"status": "waiting_input"}, "entity": {"status": "waiting_input", "prompt": "Turn it into one? [Yes/No]"},
"token": {"status": "waiting_input"}}
self.doc.modify.polyline_close(1)
tokens = [c[2]["text"] for c in self.calls if c[0] == "step" and c[1] == "token"]
self.assertEqual(tokens, ["Y", "C", "X"])
self.calls.clear()
self.step_outcome = {}
self.doc.modify.array_3d([1], 2, 2, 2, 10, 20, 30)
self.assertEqual([c[2]["text"] for c in self.calls if c[0] == "step" and c[1] == "text"], ["2", "2", "2", "10", "20", "30"])
self.calls.clear()
self.doc.modify.array_path([1], 2, 5, at=(0, 0, 0))
self.assertEqual([c[1] for c in self.calls if c[0] == "step"], ["start", "entity", "text"])
def test_batch_edit_and_rollback(self):
line = self.doc.entities[1]
self.assertEqual(line.start, (1, 2, 3))