コード例 #1
0
ファイル: test_schedule.py プロジェクト: bsmr/tribe29-checkmk
def test_endmonth_schedule():
    s = schedule.EndMonthSchedule(1, datetime.time(12, 30))
    now = datetime.datetime(2018, 3, 7, 10, 12, 32)

    next_expected = datetime.datetime(2018, 3, 31, 12, 30)
    assert s.next(now) == next_expected

    last_expected = datetime.datetime(2018, 2, 28, 12, 30)
    assert s.last(now) == last_expected
コード例 #2
0
ファイル: test_schedule.py プロジェクト: bsmr/tribe29-checkmk
def test_endmonth_schedule_two_days():
    # If the previous month has fewer days this has to be honored
    # by the EndMonthSchedule.
    s = schedule.EndMonthSchedule(3, datetime.time(12, 30))
    now = datetime.datetime(2018, 3, 7, 10, 12, 32)

    next_expected = datetime.datetime(2018, 3, 29, 12, 30)
    assert s.next(now) == next_expected

    last_expected = datetime.datetime(2018, 2, 26, 12, 30)
    assert s.last(now) == last_expected