# -*- coding: utf-8 -*-
from datetime import date
from bijoe.relative_time import RelativeDate


def test_relative_date():
    today = date(2016, 3, 3)
    assert RelativeDate(u'cette année', today=today) == date(2016, 1, 1)
    assert RelativeDate(u'ce mois', today=today) == date(2016, 3, 1)
    assert RelativeDate(u'le mois dernier', today=today) == date(2016, 2, 1)
    assert RelativeDate(u'les 4 derniers mois', today=today) == date(2015, 11, 1)
    assert RelativeDate(u'le mois  prochain', today=today) == date(2016, 4, 1)
    assert RelativeDate(u'les  3  prochains mois', today=today) == date(2016, 6, 1)
    assert RelativeDate(u' cette  semaine', today=today) == date(2016, 2, 29)
    assert RelativeDate(u' maintenant', today=today) == today
    assert RelativeDate(u'2016-01-01', today=today) == date(2016, 1, 1)
