diff --git a/masque/builder/utils.py b/masque/builder/utils.py index 5680694..b64cb85 100644 --- a/masque/builder/utils.py +++ b/masque/builder/utils.py @@ -84,7 +84,7 @@ def ell( raise BuildError('Empty port list passed to `ell()`') if ccw is None: - if spacing is not None and not numpy.isclose(spacing, 0): + if spacing is not None and not numpy.allclose(spacing, 0): raise BuildError('Spacing must be 0 or None when ccw=None') spacing = 0 elif spacing is None: diff --git a/masque/test/test_builder.py b/masque/test/test_builder.py index 0ad6e80..0553b75 100644 --- a/masque/test/test_builder.py +++ b/masque/test/test_builder.py @@ -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]))