def test_add_day_if_datetime_is_in_past(self): dt_now = datetime.now() dt = dt_now - timedelta(minutes=1) dt = add_day_if_past(dt) assert dt.day > dt_now.day dt = dt_now + timedelta(hours=1) dt = add_day_if_past(dt) assert dt.day == dt_now.day
def test_add_day_if_datetime_is_in_past(self): dt_now = datetime(2020, 1, 1, 9, 0) todocli.datetime_parser.datetime.now.return_value = dt_now dt = dt_now - timedelta(minutes=1) dt = add_day_if_past(dt) self.assertGreater(dt.day, dt_now.day) dt = dt_now + timedelta(hours=1) dt = add_day_if_past(dt) self.assertEqual(dt.day, dt_now.day)
def test_am_pm_time3(self): input_str = "12:00 am" dt = parse_datetime(input_str) dt_expected = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0) dt_expected = add_day_if_past(dt_expected) assert dt == dt_expected
def test_am_pm_time2(self): input_str = "7:00 pm" dt = parse_datetime(input_str) dt_expected = datetime.now().replace(hour=19, minute=0, second=0, microsecond=0) dt_expected = add_day_if_past(dt_expected) self.assertEqual(dt, dt_expected)