CoolFace
Apppublic

PeacebinfLow/mindseye-sandbox-flowstudio

sourceHugging Facemitupdated 10mo agoView on Hugging Face
0likes
test_sql_adapter.py45 linesDownload Raw Back to tests_06
1from engine_03.flow.sql_adapter import apply_command2 3 4def test_add_node_and_edge_and_style():5    nodes = []6    edges = []7 8    # Add node9    nodes, edges, msg1 = apply_command(10        'ADD NODE id=event_in label="Incoming Event" type=event',11        nodes,12        edges,13    )14    assert "event_in" in msg115    assert any(r[0] == "event_in" for r in nodes)16 17    # Add edge18    nodes, edges, msg2 = apply_command(19        'ADD EDGE source=event_in target=handler label="to handler"',20        nodes,21        edges,22    )23    assert "Edge event_in -> handler added." in msg224    assert any(r[0] == "event_in" and r[1] == "handler" for r in edges)25 26    # Style node27    nodes, edges, msg3 = apply_command(28        'STYLE NODE id=event_in style="fill:#0ea5e9,stroke:#0369a1"',29        nodes,30        edges,31    )32    assert "Style applied to node `event_in`." in msg333    row = next(r for r in nodes if r[0] == "event_in")34    assert "fill:#0ea5e9" in row[3]35 36    # Style edge37    nodes, edges, msg4 = apply_command(38        'STYLE EDGE source=event_in target=handler style="stroke:#22c55e,stroke-width:2px"',39        nodes,40        edges,41    )42    assert "Style applied to edge event_in -> handler." in msg443    erow = next(r for r in edges if r[0] == "event_in" and r[1] == "handler")44    assert "stroke:#22c55e" in erow[3]45