Пример #1
0
def test_incorrect_user_date_no_year_raises_UnrecognizedDateFormat(date):
    with pytest.raises(UnrecognizedDateFormat):
        human_date_to_arrow(date, 'due')
Пример #2
0
def test_incorrect_user_date_raises_MonthOrDayTooHigh(date):
    with pytest.raises(MonthOrDayTooHigh):
        human_date_to_arrow(date, 'due')
Пример #3
0
def test_human_date_to_arrow_date_m_d_complete_1():
    # if no year supplied by user, for one of the complete filters, will be assumed
    # to be this year if that date has passed in current year
    yesterday_m_d = str(arrow.now().shift(days=-1).format('M/D'))
    assert human_date_to_arrow(yesterday_m_d, 'completed') == yesterday.date()
Пример #4
0
def test_human_date_to_arrow_date_m_d_complete_2():
    # if no year supplied by user, for one of the complete filters, will be assumed
    # to be last year if that date has not passed in current year
    tomorrow_m_d = str(arrow.now().shift(days=1).format('M/D'))
    tomorrow_last_year = arrow.now().shift(days=1, years=-1).date()
    assert human_date_to_arrow(tomorrow_m_d, 'completed') == tomorrow_last_year
Пример #5
0
def test_human_date_to_arrow_date_m_d_due_1():
    # if no year supplied by user, for one of the due filters, will be assumed
    # to be next year if that date has passed in current year
    yesterday_m_d = str(arrow.now().shift(days=-1).format('M/D'))
    yesterday_next_year = arrow.now().shift(days=-1, years=1).date()
    assert human_date_to_arrow(yesterday_m_d, 'due') == yesterday_next_year
Пример #6
0
def test_human_date_to_arrow_date_m_d_due_2():
    # if no year supplied by user, for one of the due filters, will be assumed
    # to be this year if that date has not passed in current year
    tomorrow_m_d = str(arrow.now().shift(days=1).format('M/D'))
    assert human_date_to_arrow(tomorrow_m_d, 'due') == tomorrow.date()
Пример #7
0
def test_user_date_2(date):
    assert human_date_to_arrow(date, 'due') == arrow.get('2017-01-01').date()
Пример #8
0
def test_user_date_3(date):
    assert human_date_to_arrow(date, 'due') == arrow.get('2019-12-31').date()
Пример #9
0
def test_user_date_today_m_d_yy_3():
    user_tomorrow = arrow.now().shift(days=1).format('M/D/YY')
    assert human_date_to_arrow(user_tomorrow, 'due') == tomorrow.date()
Пример #10
0
def test_user_date_1(date):
    assert human_date_to_arrow(date, 'due') == arrow.get('2018-08-05').date()
Пример #11
0
def test_user_date_today_m_d_yy_2():
    user_yesterday = arrow.now().shift(days=-1).format('M/D/YY')
    assert human_date_to_arrow(user_yesterday, 'due') == yesterday.date()
Пример #12
0
def test_user_date_today_m_d_yy_1():
    user_today = arrow.now().format('M/D/YY')
    assert human_date_to_arrow(user_today, 'due') == today.date()
Пример #13
0
def test_user_date_tomorrow():
    assert human_date_to_arrow('tomorrow', 'due') == tomorrow.date()
Пример #14
0
def test_user_date_yesterday():
    assert human_date_to_arrow('yesterday', 'due') == yesterday.date()
Пример #15
0
def test_user_date_today():
    assert human_date_to_arrow('today', 'due') == today.date()