Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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)