def test_default_time_today_disabled_offset(self): date_component = _today now = datetime.now() reminder_date = TaskParser.reminder_date_combine(date_component) assert reminder_date.date() == date_component assert reminder_date.time() == _default_reminder_time
def test_reminder_implicitly_relative_to_today_no_time(self): title = 'a sample task' reminder_phrase = 'reminder' reminder_date = TaskParser.reminder_date_combine(_today) # Adds 1hr and rounds up to nearest 5m mark phrase = '%s %s' % (title, reminder_phrase) task = TaskParser(phrase) assert_task(task, phrase=phrase, title=title, reminder_date=reminder_date, has_reminder_prompt=True)
def test_default_time_today_custom_offset(self): date_component = _today now = datetime.now() reminder_date = TaskParser.reminder_date_combine(date_component) assert reminder_date.date() == date_component assert reminder_date.microsecond == 0 assert reminder_date.second == 0 assert reminder_date.minute % 5 == 0 assert reminder_date.hour == (now + timedelta(hours=2, minutes=(5 - now.minute % 5) % 5)).hour # Rounded up to the nearest 5 minute mark assert reminder_date.minute == (now + timedelta(minutes=(5 - now.minute % 5) % 5)).minute
def test_default_time_not_today(self): date_component = _tomorrow reminder_date = TaskParser.reminder_date_combine(date_component) assert reminder_date == datetime.combine(date_component, _default_reminder_time)
def test_date_and_time_as_datetimes(self): date_component = datetime.combine(_12_13_14, _default_reminder_time) time_component = datetime.combine(_today, _noon) reminder_date = TaskParser.reminder_date_combine(date_component, time_component) assert reminder_date == datetime.combine(date_component.date(), time_component.time())
def test_date_and_time(self): date_component = _12_13_14 time_component = _noon reminder_date = TaskParser.reminder_date_combine(date_component, time_component) assert reminder_date == datetime.combine(date_component, time_component)