def test_01_Blank(self): """ """ l_time = '' l_time, l_flag = TimeField()._extract_sign(l_time) # print('D2-01-A - Flag {} - "{}"\n'.format(l_flag, l_time)) self.assertEqual(l_flag, False)
def test_02_Plus(self): """ """ l_time = '+17:01' l_time, l_flag = TimeField()._extract_sign(l_time) # print('D2-02-A - Flag {} - "{}"\n'.format(l_flag, l_time)) self.assertEqual(l_flag, False)
def test_07_DuskMinus(self): """ Extract Minutes from Midnight to schedule time """ l_time = 'dusk - 00:21' l_time, l_seconds = TimeField()._rise_set(l_time, self.m_riseset) # print('D1-07-A - Seconds {} - "{}"\n'.format(l_seconds, l_time)) self.assertEqual(l_seconds, (20 * 60 + 58) * 60 + 30)
def test_04_Sunset(self): """ Extract Minutes from Midnight to schedule time """ l_time = 'sunset' l_time, l_seconds = TimeField()._rise_set(l_time, self.m_riseset) # print('D1-04-A - Seconds {} - "{}"\n'.format(l_seconds, l_time)) self.assertEqual(l_seconds, (20 * 60 + 31) * 60 + 25)
def test_03_Noon(self): """ Extract Minutes from Midnight to schedule time """ l_time = 'Noon' l_time, l_seconds = TimeField()._rise_set(l_time, self.m_riseset) # print('D1-03-A - Seconds {} - "{}"\n'.format(l_seconds, l_time)) self.assertEqual(l_seconds, (13 * 60 + 31) * 60 + 41)
def test_01_Dawn(self): """ Extract Minutes from Midnight to schedule time """ l_time = 'dawn' l_time, l_seconds = TimeField()._rise_set(l_time, self.m_riseset) # print('D1-01-A - Seconds {} - "{}"\n'.format(l_seconds, l_time)) self.assertEqual(l_seconds, (6 * 60 + 4) * 60 + 52)
def test_01_BuildSched(self): """ Testing the build of a schedule list. We should end up with 2 schedules in the list. """ l_riseset = Mock.RiseSet() l_delay, l_list = scheduleUtility.find_next_scheduled_events(self.m_pyhouse_obj, T_TODAY) l_now_sec = convert.datetime_to_seconds(T_TODAY) l_obj = self.m_pyhouse_obj.House.Schedules[0] l_sched_sec = TimeField().parse_timefield(l_obj.Time, l_riseset) self.assertEqual(len(l_list), 2) self.assertEqual(l_delay, l_sched_sec - l_now_sec) self.assertEqual(l_list[0], 0) self.assertEqual(l_list[1], 1)