17 lines
513 B
Python
17 lines
513 B
Python
from numpy.testing import assert_equal, assert_allclose
|
|
|
|
from ..shapes import Circle, Polygon
|
|
|
|
|
|
def test_circle_init() -> None:
|
|
c = Circle(radius=10, offset=(5, 5))
|
|
assert c.radius == 10
|
|
assert_equal(c.offset, [5, 5])
|
|
|
|
def test_circle_to_polygons() -> None:
|
|
c = Circle(radius=10)
|
|
polys = c.to_polygons(num_vertices=32)
|
|
assert len(polys) == 1
|
|
assert isinstance(polys[0], Polygon)
|
|
bounds = polys[0].get_bounds_single()
|
|
assert_allclose(bounds, [[-10, -10], [10, 10]], atol=1e-10)
|