[ell] fix crash when ccw=None but spacing is non-scalar

This commit is contained in:
Jan Petykiewicz 2026-04-01 21:58:21 -07:00
commit 6fd73b9d46
2 changed files with 15 additions and 1 deletions

View file

@ -129,3 +129,17 @@ def test_dead_plug_best_effort() -> None:
# P2 rot pi + transform rot -pi = 0
assert b.ports['B'].rotation is not None
assert_allclose(b.ports['B'].rotation, 0, atol=1e-10)
def test_ell_handles_array_spacing_when_ccw_none() -> None:
ports = {
'A': Port((0, 0), 0),
'B': Port((0, 1), 0),
}
scalar = ell(ports, None, 'min_extension', 5, spacing=0)
array_zero = ell(ports, None, 'min_extension', 5, spacing=numpy.array([0, 0]))
assert scalar == array_zero
with pytest.raises(BuildError, match='Spacing must be 0 or None'):
ell(ports, None, 'min_extension', 5, spacing=numpy.array([1, 0]))