示例#1
0
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'
示例#2
0
文件: utils_test.py 项目: pdav/khal
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'