示例#1
0
def test_invalid_a_b_c_setter(a):
    """Test setting invalid a, b, c values."""
    # a is invalid
    ellipsoid = Ellipsoid(1, 1, 1)
    with pytest.raises(ValueError):
        ellipsoid.a = a
    with pytest.raises(ValueError):
        ellipsoid.b = a
    with pytest.raises(ValueError):
        ellipsoid.c = a
示例#2
0
def test_a_b_c_getter_setter(a, b, c):
    """Test getter and setter for a, b, and c."""
    ellipsoid = Ellipsoid(a, b, c)
    assert ellipsoid.a == a
    assert ellipsoid.b == b
    assert ellipsoid.c == c
    ellipsoid.a = a + 1
    ellipsoid.b = b + 1
    ellipsoid.c = c + 1
    assert ellipsoid.a == a + 1
    assert ellipsoid.b == b + 1
    assert ellipsoid.c == c + 1
示例#3
0
def test_volume(a, b, c):
    ellipsoid = Ellipsoid(1, 1, 1)
    ellipsoid.a = a
    ellipsoid.b = b
    ellipsoid.c = c
    assert ellipsoid.volume == 4 / 3 * np.pi * a * b * c