[Arc] Error out on zero radius

This commit is contained in:
Jan Petykiewicz 2026-03-31 22:03:42 -07:00
commit 2176d56b4c
2 changed files with 15 additions and 6 deletions

View file

@ -128,6 +128,15 @@ def test_ellipse_integer_radii_scale_cleanly() -> None:
assert_allclose(ellipse.radii, [5, 10])
def test_arc_rejects_zero_radii_up_front() -> None:
with pytest.raises(PatternError, match='Radii must be positive'):
Arc(radii=(0, 5), angles=(0, 1), width=1)
with pytest.raises(PatternError, match='Radii must be positive'):
Arc(radii=(5, 0), angles=(0, 1), width=1)
with pytest.raises(PatternError, match='Radii must be positive'):
Arc(radii=(0, 0), angles=(0, 1), width=1)
def test_path_edge_cases() -> None:
# Zero-length segments
p = MPath(vertices=[[0, 0], [0, 0], [10, 0]], width=2)