def test_datatypes_datehelpers_invariance(): d = datetime(2017, 8, 25) before = d TimexDateHelpers.tomorrow(d) TimexDateHelpers.yesterday(d) TimexDateHelpers.date_part_equal(datetime.now(), d) TimexDateHelpers.date_part_equal(d, datetime.now()) TimexDateHelpers.is_next_week(d, datetime.now()) TimexDateHelpers.is_next_week(datetime.now(), d) TimexDateHelpers.is_last_week(datetime.now(), d) TimexDateHelpers.week_of_year(d) after = d assert after is before
def test_datatypes_datehelpers_islastweek(): today = datetime(2017, 9, 25) assert TimexDateHelpers.is_last_week(datetime(2017, 9, 20), today) is True assert TimexDateHelpers.is_last_week(datetime(2017, 9, 4), today) is False assert TimexDateHelpers.is_last_week(today, today) is False