def test_creating_circle_with_negative_radius(self):
     with self.assertRaises(ValueError) as e:
         c = Circle(-2.5)
     self.assertEqual(str(e.exception),
                      "radius must be between 0 and 1000 inclusive")
 def test_creating_circle_with_nonnumeric_radius(self):
     with self.assertRaises(TypeError) as e:
         c = Circle('hello')
     self.assertEqual(str(e.exception), "radius must be a number")
 def test_creating_circle_with_numeric_radius(self):
     c1 = Circle(2.5)
     assert c1.radius == 2.5
Beispiel #4
0
 def test_circlecircum_with_max_radius(self):
     c1 = Circle(1000)
     assert_equals(c1.circumference(), 6283.19)
Beispiel #5
0
 def test_creating_circle_with_negative_radius(self):
     with assert_raises(ValueError) as error:
         c1 = Circle(-2.5)
         assert_equals(
             "radius must be between 0 and 1000 inclusive" in error)
Beispiel #6
0
 def test_circlecircum_with_min_radius(self):
     c1 = Circle(0)
     assert_equals(c1.circumference(), 0)
Beispiel #7
0
 def test_creating_circle_with_numeric_radius(self):
     c1 = Circle(2.5)
     assert_equals(c1.radius, 2.5)
Beispiel #8
0
 def test_circlecircum_with_random_numeric_radius(self):
     c1 = Circle(2.5)
     assert_equals(c1.circumference(), 15.71)
Beispiel #9
0
 def test_circlearea_with_max_radius(self):
     c1 = Circle(1000)
     assert_equals(c1.area(), 3141592.65)
Beispiel #10
0
 def test_circlearea_with_min_radius(self):
     c1 = Circle(0)
     assert_equals(c1.area(), 0)
Beispiel #11
0
 def test_circlearea_with_random_numeric_radius(self):
     c1 = Circle(2.5)
     assert_equals(c1.area(), 19.63)
Beispiel #12
0
 def test_creating_circle_with_nonnumeric_radius(self):
     with assert_raises(TypeError) as error:
         c1 = Circle('hello')
         assert_equals(
             "radius must be between 0 and 1000 inclusive" in error)