def covered(self, range_obj: RangeDateTime) -> bool: day_off_assignations = self.get_day_off_assignations() for day_off_assignation in day_off_assignations: day_off_assignation_facade = DayOffAssignationFacade( day_off_assignation) if day_off_assignation_facade.is_in(range_obj): return True return False
def test_is_in_5(self): day_off_assignations_data = [{ 'person_id': 1, 'starting_date': '2019-1-1', 'ending_date': '2019-1-6', 'starting_time': '06:00', 'ending_time': '05:59' }] day_off_assignations = create_proxy_day_off_assignation( day_off_assignations_data) facade = DayOffAssignationFacade(day_off_assignations[0]) range_datetime = RangeDateTime( datetime(2019, 1, 2, 1, 10), datetime(2019, 1, 4, 2, 10), ) assert facade.is_in(range_datetime)
def test_is_not_in_6(self): day_off_assignations_data = [{ 'person_id': 1, 'starting_date': '2019-1-1', 'ending_date': '2019-1-9', 'starting_time': '20:00', 'ending_time': '08:00' }] day_off_assignations = create_proxy_day_off_assignation( day_off_assignations_data) facade = DayOffAssignationFacade(day_off_assignations[0]) range_datetime = RangeDateTime( datetime(2019, 1, 2, 20, 59), datetime(2019, 1, 3, 8, 1), ) assert not facade.is_in(range_datetime)