def get_schedule_at(at: Optional[str]) -> Optional[datetime.datetime]: if at is None: return None try: dt = utils.parse_datetime(at) except ValueError: raise click.BadOptionUsage("--at", f"Cannot parse datetime {at}") return dt
def test_parse_datetime(input, expected): assert utils.parse_datetime(input) == expected