Exemple #1
0
def test_invalid_area_setter(area):
    """Test setting an invalid Volume."""
    sphere = Sphere(1)
    with pytest.raises(ValueError):
        sphere.surface_area = area
Exemple #2
0
def test_area_getter_setter(area):
    """Test setting the volume."""
    sphere = Sphere(1)
    sphere.surface_area = area
    assert sphere.surface_area == approx(area)
    assert sphere.radius == approx(np.sqrt(area / (4 * np.pi)))