def test_best_fit(points, sphere_expected): points = Points(points) sphere_fit = Sphere.best_fit(points) assert sphere_fit.point.is_close(sphere_expected.point, abs_tol=1e-9) assert math.isclose(sphere_fit.radius, sphere_expected.radius)
def test_best_fit_failure(points, message_expected): with pytest.raises(ValueError, match=message_expected): Sphere.best_fit(points)