def test_datatypes_datehelpers_yesterday(): assert TimexDateHelpers.yesterday(datetime(2017, 1, 1)) == datetime(2016, 12, 31) assert TimexDateHelpers.yesterday(datetime(2017, 1, 2)) == datetime(2017, 1, 1) assert TimexDateHelpers.yesterday(datetime(2017, 3, 1)) == datetime(2017, 2, 28) assert TimexDateHelpers.yesterday(datetime(2016, 2, 29)) == datetime(2016, 2, 28)
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