def test_sphere_alt_constructor(): my_sphere = Sphere.from_diameter(8) assert repr(my_sphere) == 'Sphere(4)' assert my_sphere.diameter == 8
def my_sphere(): return Sphere(4)
def test_sphere_from_diameter(): s = Sphere.from_diameter(8) assert s.radius == 4
def test_sphere_adding(): s1 = Sphere(2) s2 = Sphere(3) assert s1 + s2 == Sphere(5)
def test_sphere_area(): s = Sphere(4) print(s.area) assert "{:.2f}".format(s.area) == '201.06'
def test_sphere_volume(): s = Sphere(4) print(s) print(s.volume) assert "{:.2f}".format(s.volume) == '268.08'
def test_sphere_repr(): s = Sphere(4) assert (repr(s)) == "Sphere(4)"
def test_sphere_string(): s = Sphere(4) assert s.__str__() == "Sphere with radius: 4.000000"
def test_sphere_init(): Sphere() Sphere(4)