def IsLocalTimeWithinScheduledEvent(self, eventName, localTime): startTime = self.GetEvent(eventName).StartTime endTime = self.GetEvent(eventName).EndTime return Utils.IsTimeWithinSchedule(localTime, startTime, endTime)
def test_SpecifyThatTimeCanBeRangedChecked(self): # arrange onTimeDay = datetime.time(8, 30) # 8:30 am offTimeDay = datetime.time(22, 45) # 10:45 pm onTimeNight = datetime.time(22, 45) # 10:45 pm offTimeNight = datetime.time(8, 30) # 8:30 am # assert self.assertEqual( Utils.IsTimeWithinSchedule(datetime.time(8, 29), onTimeDay, offTimeDay), False) self.assertEqual( Utils.IsTimeWithinSchedule(datetime.time(8, 30), onTimeDay, offTimeDay), True) self.assertEqual( Utils.IsTimeWithinSchedule(datetime.time(10, 00), onTimeDay, offTimeDay), True) self.assertEqual( Utils.IsTimeWithinSchedule(datetime.time(22, 44), onTimeDay, offTimeDay), True) self.assertEqual( Utils.IsTimeWithinSchedule(datetime.time(22, 45), onTimeDay, offTimeDay), False) self.assertEqual( Utils.IsTimeWithinSchedule(datetime.time(22, 44), onTimeNight, offTimeNight), False) self.assertEqual( Utils.IsTimeWithinSchedule(datetime.time(22, 45), onTimeNight, offTimeNight), True) self.assertEqual( Utils.IsTimeWithinSchedule(datetime.time(23, 30), onTimeNight, offTimeNight), True) self.assertEqual( Utils.IsTimeWithinSchedule(datetime.time(8, 29), onTimeNight, offTimeNight), True) self.assertEqual( Utils.IsTimeWithinSchedule(datetime.time(8, 30), onTimeNight, offTimeNight), False) self.assertEqual( Utils.IsTimeWithinSchedule(datetime.time(8, 31), onTimeNight, onTimeNight), False)