def test_incorrect_user_date_no_year_raises_UnrecognizedDateFormat(date): with pytest.raises(UnrecognizedDateFormat): human_date_to_arrow(date, 'due')
def test_incorrect_user_date_raises_MonthOrDayTooHigh(date): with pytest.raises(MonthOrDayTooHigh): human_date_to_arrow(date, 'due')
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()
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
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
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()
def test_user_date_2(date): assert human_date_to_arrow(date, 'due') == arrow.get('2017-01-01').date()
def test_user_date_3(date): assert human_date_to_arrow(date, 'due') == arrow.get('2019-12-31').date()
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()
def test_user_date_1(date): assert human_date_to_arrow(date, 'due') == arrow.get('2018-08-05').date()
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()
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()
def test_user_date_tomorrow(): assert human_date_to_arrow('tomorrow', 'due') == tomorrow.date()
def test_user_date_yesterday(): assert human_date_to_arrow('yesterday', 'due') == yesterday.date()
def test_user_date_today(): assert human_date_to_arrow('today', 'due') == today.date()