示例#1
0
文件: test_dates.py 项目: jaredly/pm
def test_parse_week():
    today = date(2013, day=22, month=3)
    this_week = dates.lastmonday(today)
    data = (
        ('this week', this_week),
        ('last week', this_week - timedelta(7)),
        ('next week', this_week + timedelta(7))
    )
    for inp, out in data:
        res = dates.parse_week(inp, today=today)
        assert res == out, '{} : {} = {}'.format(inp, res, out)
示例#2
0
文件: test_dates.py 项目: jaredly/pm
def test_lm():
    '''Test the lastmonday(datetime.date) function'''

    for inp, out in last_monday:
        res = dates.lastmonday(inp)
        assert res == out, '{} : {} = {}'.format(inp, res, out)