예제 #1
0
 def test_compute_vspeed(self):
     singleRun = single_run.SingleRun()
     config_dict = {'climb': 10}
     singleRun.climb = 600
     singleRun.time = 60
     singleRun.compute_vspeed()
     self.assertEqual(singleRun.vspeed, 600)
예제 #2
0
 def test_compute_vspeed_time_is_0(self):
     singleRun = single_run.SingleRun()
     config_dict = {'climb': 10}
     singleRun.climb = 600
     singleRun.time = 0
     singleRun.compute_vspeed()
     self.assertTrue(math.isnan(singleRun.vspeed))
예제 #3
0
    def test_fill_type_invalid(self):
        singleRun = single_run.SingleRun()

        #creating a type not in RUN_TYPES_DICTIONARY
        base_string = 'a'
        while base_string in runTypes.RUN_TYPES_DICTIONARY.values():
            base_string += 'a'

        config_dict = {'type': base_string}
        singleRun.fill_type(config_dict)
        self.assertEqual(singleRun.type, runTypes.RUN_TYPES_ENUM.E)
예제 #4
0
 def test_missing_distance_raise_exception(self):
     singleRun = single_run.SingleRun()
     config_dict = {'invalid_key': 10}
     with self.assertRaises(KeyError):
         singleRun.fill_distance(config_dict)
예제 #5
0
 def test_fill_distance_valid(self):
     singleRun = single_run.SingleRun()
     config_dict = {'distance': 10}
     singleRun.fill_distance(config_dict)
     self.assertEqual(singleRun.distance, 10)
예제 #6
0
 def test_fill_time_valid(self):
     singleRun = single_run.SingleRun()
     config_dict = {'time': '1h'}
     singleRun.fill_time(config_dict)
     self.assertEqual(singleRun.time, 60)
예제 #7
0
 def test_fill_route(self):
     singleRun = single_run.SingleRun()
     config_dict = {'route': 'La Mitja'}
     singleRun.fill_route(config_dict)
     self.assertEqual(singleRun.route, 'La Mitja')
예제 #8
0
 def test_fill_climb_valid(self):
     singleRun = single_run.SingleRun()
     config_dict = {'climb': 10}
     singleRun.fill_climb(config_dict)
     self.assertEqual(singleRun.climb, 10)
예제 #9
0
 def test_fill_notes(self):
     singleRun = single_run.SingleRun()
     config_dict = {'notes': 'Nice run!'}
     singleRun.fill_notes(config_dict)
     self.assertEqual(singleRun.notes, 'Nice run!')
예제 #10
0
 def test_fill_feeling_missing_value(self):
     singleRun = single_run.SingleRun()
     config_dict = {}
     singleRun.fill_feeling(config_dict)
     self.assertEqual(singleRun.feeling, None)
예제 #11
0
 def test_fill_feeling_valid(self):
     singleRun = single_run.SingleRun()
     config_dict = {'feeling': 5}
     singleRun.fill_feeling(config_dict)
     self.assertEqual(singleRun.feeling, 5)
예제 #12
0
 def test_fill_is_trail_running_missing(self):
     singleRun = single_run.SingleRun()
     config_dict = {}
     singleRun.fill_is_trail_running(config_dict)
     self.assertEqual(singleRun.is_trail_running, False)
예제 #13
0
 def test_fill_is_trail_running2(self):
     singleRun = single_run.SingleRun()
     config_dict = {'trail': 1}
     singleRun.fill_is_trail_running(config_dict)
     self.assertEqual(singleRun.is_trail_running, True)
예제 #14
0
 def test_fill_route_missing(self):
     singleRun = single_run.SingleRun()
     config_dict = {}
     singleRun.fill_route(config_dict)
     self.assertEqual(singleRun.route, '')
예제 #15
0
 def test_fill_date_valid(self):
     singleRun = single_run.SingleRun()
     config_dict = {'date': '01/05/2020'}
     singleRun.fill_date(config_dict)
     dateObj = datetime.datetime.strptime("01/05/2020", "%d/%m/%Y").date()
     self.assertEqual(singleRun.date, dateObj)
예제 #16
0
 def test_missing_date_raise_exception(self):
     singleRun = single_run.SingleRun()
     config_dict = {'invalid_key': '01/05/2020'}
     with self.assertRaises(KeyError):
         singleRun.fill_date(config_dict)
예제 #17
0
 def test_fill_type_valid2(self):
     singleRun = single_run.SingleRun()
     config_dict = {'type': blockNames.RunTypes.T}
     singleRun.fill_type(config_dict)
     self.assertEqual(singleRun.type, runTypes.RUN_TYPES_ENUM.T)
예제 #18
0
 def test_fill_climb_missing_value(self):
     singleRun = single_run.SingleRun()
     config_dict = {}
     singleRun.fill_type(config_dict)
     self.assertEqual(singleRun.climb, 0)
예제 #19
0
 def test_fill_notes_missing(self):
     singleRun = single_run.SingleRun()
     config_dict = {}
     singleRun.fill_notes(config_dict)
     self.assertEqual(singleRun.notes, '')
예제 #20
0
 def test_fill_type_missing(self):
     singleRun = single_run.SingleRun()
     config_dict = {}
     singleRun.fill_type(config_dict)
     self.assertEqual(singleRun.type, runTypes.RUN_TYPES_ENUM.E)
예제 #21
0
 def test_fill_where(self):
     singleRun = single_run.SingleRun()
     config_dict = {'where': 'park'}
     singleRun.fill_where(config_dict)
     self.assertEqual(singleRun.where, 'park')