Exemplo n.º 1
0
def test_sphere_init_methods():
    s = Sphere(test_radius_int)
    assert (s.radius == test_radius)
    assert (s.diameter == test_diameter)
    assert (s.circumference == test_circum)
    assert (s.area == test_sphere_area)
    assert (s.volume == test_sphere_volume)
    # Test diameter property setter
    s.diameter = test_diameter * float(2.0)
    assert (s.radius == test_radius * float(2.0))
    assert (s.diameter == test_diameter * float(2.0))
    assert (s.circumference == test_circum * float(2.0))
    assert (s.area == test_sphere_area * float(4.0))
    assert (s.volume == test_sphere_volume * float(8.0))
Exemplo n.º 2
0
def test_set_diameter():
    radius = 1
    c = Sphere(radius)
    c.diameter = radius * 2
    assert c.diameter == radius * 2