def test_relative_timedelta_str(): with freeze_time('2016-9-19'): assert utils.relative_timedelta_str(date(2016, 9, 24)) == '5 days from now' assert utils.relative_timedelta_str(date(2016, 9, 29)) == '~1 week from now' assert utils.relative_timedelta_str(date(2017, 9, 29)) == '~1 year from now' assert utils.relative_timedelta_str(date(2016, 7, 29)) == '~7 weeks ago'
def test_relative_timedelta_str(): with freeze_time('2016-9-19'): assert utils.relative_timedelta_str(dt.date(2016, 9, 24)) == '5 days from now' assert utils.relative_timedelta_str(dt.date(2016, 9, 29)) == '~1 week from now' assert utils.relative_timedelta_str(dt.date(2017, 9, 29)) == '~1 year from now' assert utils.relative_timedelta_str(dt.date(2016, 7, 29)) == '~7 weeks ago'