Пример #1
0
def test_every_monday():
    cal = Calendar(date(2017, 10, 15))
    days = cal.weekday('Monday', 4)

    assert days == [
        date(2017, 10, 16),
        date(2017, 10, 23),
        date(2017, 10, 30),
        date(2017, 11, 6)
    ]
Пример #2
0
def test_last_friday():
    cal = Calendar(date(2017, 10, 15))
    days = cal.last_weekday('Friday', 4)

    assert days == [
        date(2017, 10, 27),
        date(2017, 11, 24),
        date(2017, 12, 29),
        date(2018, 1, 26)
    ]
Пример #3
0
def test_third_thursday():
    cal = Calendar(date(2017, 10, 15))
    days = cal.nth_weekday(3, 'Thursday', 4)

    assert days == [
        date(2017, 10, 19),
        date(2017, 11, 16),
        date(2017, 12, 21),
        date(2018, 1, 18)
    ]