Пример #1
0
def test_business_hours_over_weeks():
    start = parse("Mon, 4 Feb 2019 10:00:00")
    end = parse("Mon, 18 Feb 2019 10:00:00")
    assert business_hours_between_dates(start, end) == timedelta(hours=80)
Пример #2
0
def test_business_hours_with_microseconds():
    start = datetime(2019, 2, 4, 9, 1, 2, 3)
    end = datetime(2019, 2, 5, 9, 1, 2, 4)
    assert business_hours_between_dates(start,
                                        end) == timedelta(hours=8,
                                                          microseconds=1)
Пример #3
0
def test_business_hours_ending_on_weekend():
    start = parse("Fri, 1 Feb 2019 10:00:00")
    end = parse("Sun, 3 Feb 2019 10:00:00")
    assert business_hours_between_dates(start, end) == timedelta(hours=7)
Пример #4
0
def test_business_hours_starting_and_ending_on_weekend():
    start = parse("Sat, 2 Feb 2019 10:00:00")
    end = parse("Sun, 3 Feb 2019 13:00:00")
    assert business_hours_between_dates(start, end) == timedelta(hours=0)
Пример #5
0
def test_business_hours_between_dates_across_weekend():
    start = parse("Fri, 1 Feb 2019 00:00:00")
    end = parse("Mon, 4 Feb 2019 23:59:59")
    assert business_hours_between_dates(start, end) == timedelta(hours=16)
Пример #6
0
def test_business_hours_between_dates_across_weekdays_after_end_of_business_hours(
):
    start = parse("Mon, 4 Feb 2019 18:00:00")
    end = parse("Tue, 5 Feb 2019 10:00:00")
    assert business_hours_between_dates(start, end) == timedelta(hours=1)
Пример #7
0
def test_business_hours_between_dates_across_weekdays_before_start_of_business_hours(
):
    start = parse("Mon, 4 Feb 2019 00:00:00")
    end = parse("Tue, 5 Feb 2019 08:59:59")
    assert business_hours_between_dates(start, end) == timedelta(hours=8)
Пример #8
0
def test_business_hours_between_dates_within_day_and_outside_business_hours():
    start = parse("Mon, 4 Feb 2019 00:00:00")
    end = parse("Mon, 4 Feb 2019 23:59:59")
    assert business_hours_between_dates(start, end) == timedelta(hours=8)
Пример #9
0
def test_business_hours_between_dates_for_dates_within_day_and_business_hours(
):
    start = parse("Mon, 4 Feb 2019 09:00:00")
    end = parse("Mon, 4 Feb 2019 17:00:00")
    assert business_hours_between_dates(start, end) == timedelta(hours=8)