def test_rectangle(): rect = shapes.rect(3, 2) extends = bbox([rect]) assert extends.extmin.isclose((-1.5, -1.0)) assert extends.extmax.isclose((1.5, 1.0)) assert rect.is_closed is True
def test_transformed_rectangle(): m = basic_transformation(z_rotation=math.pi / 2) rect = shapes.rect(3, 2, transform=m) extends = bbox([rect]) assert extends.extmin.isclose((-1.0, -1.5)) assert extends.extmax.isclose((1.0, 1.5))
def test_invalid_rect_dimensions(w, h): with pytest.raises(ValueError): shapes.rect(w, h)