Пример #1
0
    def test_model_perform_all_message_logging(self):
        model = VolumeViewModel()
        model.set_start_value(3)
        model.set_end_value(10)
        model.perform()

        log_message = [
            'Hi!', 'Setting radius value - 3', 'Setting height value - 10',
            'Radiobutton 0 (cube) selected', 'Result = 1000'
        ]
        self.assertEqual(log_message, model.logger.get_log_messages()[-5:])
Пример #2
0
    def test_model_sphere_message_logging(self):
        model = VolumeViewModel()
        model.set_figure_type(1)
        model.set_start_value(10)
        model.set_end_value(3)
        model.perform()

        log_message = [
            'Hi!', 'Setting radius value - 10', 'Setting height value - 3',
            'Radiobutton 1 (sphere) selected', 'Result = 4188.79'
        ]
        self.assertEqual(log_message, model.logger.get_log_messages()[-5:])
Пример #3
0
 def test_model_perform_logging(self):
     model = VolumeViewModel()
     model.set_start_value(3)
     model.set_end_value(10)
     model.perform()
     self.assertEqual('Result = 1000', model.logger.get_last_message())
Пример #4
0
 def test_calculate_cylinder_volume_3_5(self):
     model = VolumeViewModel(3, 5)
     model.set_figure_type(2)
     model.perform()
     self.assertEqual(141.372, model.get_result())
Пример #5
0
 def test_calculate_sphere_volume_3(self):
     model = VolumeViewModel(3, 5)
     model.set_figure_type(1)
     model.perform()
     self.assertEqual(113.097, model.get_result())
Пример #6
0
 def test_calculate_cube_volume_5(self):
     model = VolumeViewModel(3, 5)
     model.set_figure_type(0)
     model.perform()
     self.assertEqual(125, model.get_result())