Esempio n. 1
0
 def test_01_Mins(self):
     """Convert a datetime to Minutes
     """
     l_minutes = scheduleUtility.to_mins(T_NOW)
     self.assertEqual(l_minutes, 12 * 60 + 34)
     l_minutes = scheduleUtility.to_mins(T_SUNRISE)
     self.assertEqual(l_minutes, 7 * 60 + 12)
     l_minutes = scheduleUtility.to_mins(T_SUNSET)
     self.assertEqual(l_minutes, 20 * 60 + 19)
Esempio n. 2
0
 def test_1_Mins(self):
     """Convert a datetime to Minutes
     """
     l_minutes = scheduleUtility.to_mins(T_TODAY)
     # print(PrettyFormatAny.form(l_minutes, 'A3-1-A - Minutes'))
     self.assertEqual(l_minutes, 12 * 60 + 34)
     l_minutes = scheduleUtility.to_mins(TESTING_SCHEDULE_SUNRISE_0)
     self.assertEqual(l_minutes, TESTING_SCHEDULE_SUNRISE_HOUR_0 * 60 + TESTING_SCHEDULE_SUNRISE_MINUTE_0)
     l_minutes = scheduleUtility.to_mins(TESTING_SCHEDULE_SUNSET_0)
     self.assertEqual(l_minutes, TESTING_SCHEDULE_SUNSET_HOUR_0 * 60 + TESTING_SCHEDULE_SUNSET_MINUTE_0)
Esempio n. 3
0
 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 = scheduleUtility.to_mins(T_TODAY) * 60
     l_obj = self.m_pyhouse_obj.House.Schedules[l_list[0]]
     l_sched_sec = SchedTime._extract_schedule_time(l_obj, l_riseset) * 60
     print('C2-01-A - Delay: {}; List: {}; Now: {}; Sched: {}'.format(l_delay, l_list, l_now_sec, l_sched_sec))
     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)
Esempio n. 4
0
 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_NOW)
     l_now_sec = scheduleUtility.to_mins(T_NOW) * 60
     l_obj = self.m_pyhouse_obj.House.Schedules[l_list[0]]
     l_sched_sec = SchedTime._extract_schedule_time(l_obj, l_riseset) * 60
     # print('Delay: {}; List: {}; Now: {}; Sched: {}'.format(l_delay, l_list, l_now_sec, l_sched_sec))
     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)