def test_calculate_area_cone_int(self):
     self.assertEqual(Figure(r=2, l=3).calculate_area_cone(), 31.416)
 def test_calculate_area_cube_int(self):
     self.assertEqual(Figure(a=5).calculate_area_cube(), 150)
 def test_calculate_area_cylinder_default(self):
     self.assertEqual(Figure().calculate_area_cylinder(), 12.566)
 def test_calculate_area_sphere_default(self):
     self.assertEqual(Figure().calculate_area_sphere(), 12.566)
 def test_calculate_area_cylinder_float(self):
     self.assertEqual(
         Figure(r=2.3, h=4.2).calculate_area_cylinder(), 93.934)
 def test_can_create_figure_init_all(self):
     figure = Figure(1, 2, 3, 4)
     self.assertTrue(figure.a == 1 and figure.r == 2 and figure.h == 3
                     and figure.l == 4)
 def test_can_create_figure_neg_init_1(self):
     with self.assertRaises(InvalidFigureError):
         Figure(a=-1)
 def test_calculate_area_cone_float(self):
     self.assertEqual(Figure(r=2.3, l=3.8).calculate_area_cone(), 44.077)
 def test_can_create_figure_init_sphere(self):
     figure = Figure(r=2)
     self.assertTrue(figure.r == 2)
 def test_can_create_figure_neg_init_list(self):
     with self.assertRaises(InvalidFigureError):
         Figure([1, 2])
 def test_can_create_figure_init_cylinder(self):
     figure = Figure(r=2, h=4)
     self.assertTrue(figure.r == 2, figure.h == 4)
 def test_can_create_figure_init_cube(self):
     figure = Figure(5)
     self.assertTrue(figure.a == 5)
 def test_can_create_figure_init_cone(self):
     figure = Figure(r=2, l=3)
     self.assertTrue(figure.r == 2 and figure.l == 3)
 def test_calculate_area_cylinder_int(self):
     self.assertEqual(Figure(r=2, h=4).calculate_area_cylinder(), 75.398)
 def test_calculate_area_cone_default(self):
     self.assertEqual(Figure().calculate_area_cone(), 6.283)
 def test_calculate_area_sphere_int(self):
     self.assertEqual(Figure(r=2).calculate_area_sphere(), 50.265)
 def test_calculate_area_cube_default(self):
     self.assertEqual(Figure().calculate_area_cube(), 6)
 def test_calculate_area_cube_float(self):
     self.assertEqual(Figure(a=5.9).calculate_area_cube(), 208.86)
 def test_can_create_figure_default(self):
     figure = Figure()
     self.assertTrue(isinstance(figure, Figure))
 def test_calculate_area_sphere_float(self):
     self.assertEqual(Figure(r=2.3).calculate_area_sphere(), 66.476)
 def calculate(self):
     if self.calc_button_state == "normal":
         if self.figure_type == "CONE":
             figure = Figure(r=float(self.r), l=float(self.l))
             self.area = figure.calculate_area_cone()
         elif self.figure_type == "CUBE":
             figure = Figure(a=float(self.a))
             self.area = figure.calculate_area_cube()
         elif self.figure_type == "SPHERE":
             figure = Figure(r=float(self.r))
             self.area = figure.calculate_area_sphere()
         elif self.figure_type == "CYLINDER":
             figure = Figure(r=float(self.r), h=float(self.h))
             self.area = figure.calculate_area_cylinder()
         self.area = str(self.area)
         return