[data_to_ports] warn on invalid angle

This commit is contained in:
Jan Petykiewicz 2026-04-01 19:22:16 -07:00
commit fbe138d443
2 changed files with 22 additions and 1 deletions

View file

@ -116,3 +116,17 @@ def test_data_to_ports_hierarchical_collision_is_atomic() -> None:
data_to_ports([layer], lib, parent, max_depth=1)
assert not parent.ports
def test_data_to_ports_flat_bad_angle_warns_and_skips(
caplog: pytest.LogCaptureFixture,
) -> None:
layer = (10, 0)
pat = Pattern()
pat.label(layer=layer, string="A:type1 nope", offset=(5, 0))
caplog.set_level("WARNING")
data_to_ports([layer], {}, pat)
assert not pat.ports
assert any('bad angle' in record.message for record in caplog.records)