def test_night_shift(self): begin = time(8, 30) end = time(20, 30) policy = Policy(weekends=(SAT, SUN), holidays=holidays, hours=(end, begin)) self.assertFalse(policy.is_not_in_business_hours(datetime(2011, 7, 1, 7, 0))) self.assertTrue(policy.is_not_in_business_hours(datetime(2011, 7, 1, 17, 0))) self.assertFalse(policy.is_not_in_business_hours(datetime(2011, 7, 1, 8, 30)))
def test_night_shift(self): begin = time(8, 30) end = time(20, 30) policy = Policy(weekends=(SAT, SUN), holidays=holidays, hours=(end, begin)) self.assertFalse( policy.is_not_in_business_hours(datetime(2011, 7, 1, 7, 0))) self.assertTrue( policy.is_not_in_business_hours(datetime(2011, 7, 1, 17, 0))) self.assertFalse( policy.is_not_in_business_hours(datetime(2011, 7, 1, 8, 30)))
def test_no_hours(self): policy = Policy(weekends=(SAT, SUN), holidays=holidays) self.assertFalse(policy.is_not_in_business_hours(time(19, 25)))