[boundary_from_poly] handle empty poly correctly

This commit is contained in:
Jan Petykiewicz 2026-03-31 23:25:53 -07:00
commit e2f6aea0a0
2 changed files with 5 additions and 0 deletions

View file

@ -295,6 +295,8 @@ def boundary_from_poly(poly: poly_t) -> list[dict[str, Any]]:
"""
neighbors = poly['neighbors']
vertices = poly['vertices']
if vertices.shape[0] == 0:
return []
owning_component = find_components(neighbors)
faces = find_faces(neighbors)

View file

@ -4,6 +4,9 @@ from numpy.testing import assert_allclose
import adze
def test_boundary_from_empty_poly() -> None:
assert adze.boundary_from_poly(adze.util.build_empty()) == []
@pytest.mark.parametrize('order', [0, 1, 2, 3])
def test_empty_poly_moments_shape(order: int) -> None: