示例#1
0
def test_get_weekday_occurrence():
    assert get_weekday_occurrence(datetime(2017, 3, 1)) == (2, 1)
    assert get_weekday_occurrence(datetime(2017, 3, 2)) == (3, 1)
    assert get_weekday_occurrence(datetime(2017, 3, 3)) == (4, 1)
    assert get_weekday_occurrence(datetime(2017, 3, 4)) == (5, 1)
    assert get_weekday_occurrence(datetime(2017, 3, 5)) == (6, 1)
    assert get_weekday_occurrence(datetime(2017, 3, 6)) == (0, 1)
    assert get_weekday_occurrence(datetime(2017, 3, 7)) == (1, 1)
    assert get_weekday_occurrence(datetime(2017, 3, 8)) == (2, 2)
    assert get_weekday_occurrence(datetime(2017, 3, 9)) == (3, 2)
    assert get_weekday_occurrence(datetime(2017, 3, 10)) == (4, 2)

    assert get_weekday_occurrence(datetime(2017, 3, 31)) == (4, 5)

    assert get_weekday_occurrence(date(2017, 5, 1)) == (0, 1)
    assert get_weekday_occurrence(date(2017, 5, 7)) == (6, 1)
    assert get_weekday_occurrence(date(2017, 5, 8)) == (0, 2)
    assert get_weekday_occurrence(date(2017, 5, 28)) == (6, 4)
    assert get_weekday_occurrence(date(2017, 5, 29)) == (0, 5)
示例#2
0
文件: utils_test.py 项目: pdav/khal
def test_get_weekday_occurrence():
    assert utils.get_weekday_occurrence(dt.datetime(2017, 3, 1)) == (2, 1)
    assert utils.get_weekday_occurrence(dt.datetime(2017, 3, 2)) == (3, 1)
    assert utils.get_weekday_occurrence(dt.datetime(2017, 3, 3)) == (4, 1)
    assert utils.get_weekday_occurrence(dt.datetime(2017, 3, 4)) == (5, 1)
    assert utils.get_weekday_occurrence(dt.datetime(2017, 3, 5)) == (6, 1)
    assert utils.get_weekday_occurrence(dt.datetime(2017, 3, 6)) == (0, 1)
    assert utils.get_weekday_occurrence(dt.datetime(2017, 3, 7)) == (1, 1)
    assert utils.get_weekday_occurrence(dt.datetime(2017, 3, 8)) == (2, 2)
    assert utils.get_weekday_occurrence(dt.datetime(2017, 3, 9)) == (3, 2)
    assert utils.get_weekday_occurrence(dt.datetime(2017, 3, 10)) == (4, 2)

    assert utils.get_weekday_occurrence(dt.datetime(2017, 3, 31)) == (4, 5)

    assert utils.get_weekday_occurrence(dt.date(2017, 5, 1)) == (0, 1)
    assert utils.get_weekday_occurrence(dt.date(2017, 5, 7)) == (6, 1)
    assert utils.get_weekday_occurrence(dt.date(2017, 5, 8)) == (0, 2)
    assert utils.get_weekday_occurrence(dt.date(2017, 5, 28)) == (6, 4)
    assert utils.get_weekday_occurrence(dt.date(2017, 5, 29)) == (0, 5)