コード例 #1
0
def test_sphere_init():
    s1 = Sphere(6)
    assert type(s1) is Sphere
    assert s1.radius == 6
    assert s1.diameter == 6 * 2
    s2 = Sphere.from_diameter(3)
    assert type(s2) is Sphere
コード例 #2
0
 def test_ing_sphere_classmethod(self):
         i = random.randint(0,50)
         j = random.randint(51,100)
         c1 = Sphere.from_diameter(i)
         self.assertEqual(eval(repr(c1)), Sphere(i/2))