def test_sphere(): sph1 = circle_class.Sphere(3) sph2 = circle_class.Sphere(4) assert sph1.radius == 3 assert round(sph1.volume, 1) == round(4 / 3 * 3.1415 * 3 ** 3, 1) assert round(sph1.area, 1) == round(4 * 3.1415 * 3 ** 2, 1) assert sph1.__str__() == "Sphere with a radius of: 3" assert sph1.__repr__() == "Sphere(3)" assert sph1 + sph2 == circle_class.Sphere(7) assert sph1 * 2 == circle_class.Sphere(6) assert 4 * sph1 == circle_class.Sphere(12) assert sph1 < sph2 assert sph2 > sph1
def test_volum(self): c = circle_class.Sphere(2) print(c.radius) assert str(c.volum).startswith("33.51")
def test_sphere(self): c = circle_class.Sphere(1) assert c.radius == 1 assert c.diameter == 2
def test_repr_sphere(self): c = circle_class.Sphere(4) assert repr(c) == "Sphere(4)"
def test_str_sphere(self): c = circle_class.Sphere(4) assert str(c) == "Sphere with radius: 4"
def test_area_sphere(self): c = circle_class.Sphere(2) assert str(c.area).startswith("50.26")