예제 #1
0
    def test_given_distant_dates_returns_False(self):
        start_date1 = datetime.strptime('2017-01-26', '%Y-%m-%d').date()
        end_date1 = datetime.strptime('2017-01-27', '%Y-%m-%d').date()

        start_date2 = datetime.strptime('2017-09-27', '%Y-%m-%d').date()
        end_date2 = datetime.strptime('2017-09-28', '%Y-%m-%d').date()

        self.assertFalse(
            is_overlap(start_date1, start_date2, end_date1, end_date2))
예제 #2
0
    def test_given_end_date_equals_another_booking_start_date_returns_False(
            self):
        start_date1 = datetime.strptime('2017-09-26', '%Y-%m-%d').date()
        end_date1 = datetime.strptime('2017-09-27', '%Y-%m-%d').date()

        start_date2 = datetime.strptime('2017-09-27', '%Y-%m-%d').date()
        end_date2 = datetime.strptime('2017-09-28', '%Y-%m-%d').date()

        self.assertFalse(
            is_overlap(start_date1, start_date2, end_date1, end_date2))
예제 #3
0
    def test_given_second_range_ends_within_first_range_is_overlap_return_True(
            self):
        start_date1 = datetime.strptime('2017-09-27', '%Y-%m-%d').date()
        end_date1 = datetime.strptime('2017-10-10', '%Y-%m-%d').date()

        start_date2 = datetime.strptime('2017-09-21', '%Y-%m-%d').date()
        end_date2 = datetime.strptime('2017-09-29', '%Y-%m-%d').date()

        self.assertTrue(
            is_overlap(start_date1, start_date2, end_date1, end_date2))