def test_invalid_a_b_setter(a): """Test setting invalid a, b values.""" ellipse = Ellipse(1, 1) with pytest.raises(ValueError): ellipse.a = a with pytest.raises(ValueError): ellipse.b = a
def test_a_b_getter_setter(a, b): """Test getter and setter for a and b.""" ellipse = Ellipse(a, b) assert ellipse.a == a assert ellipse.b == b ellipse.a = a + 1 ellipse.b = b + 1 assert ellipse.a == a + 1 assert ellipse.b == b + 1
def test_area_getter(a, b): ellipse = Ellipse(1, 1) ellipse.a = a ellipse.b = b assert ellipse.area == np.pi * a * b