diff --git a/tests/test_recur.py b/tests/test_recur.py index b79b2fe..9c29d55 100644 --- a/tests/test_recur.py +++ b/tests/test_recur.py @@ -169,5 +169,9 @@ def test_annually(): def test_unsupported(): - pass + with pytest.raises(Exception): + utils.parse_recur('every mon,tues,weds') + + with pytest.raises(Exception): + utils.parse_recur('every monday,tuesday,wednesday') diff --git a/todoist_taskwarrior/utils.py b/todoist_taskwarrior/utils.py index 7464a3e..059bc63 100644 --- a/todoist_taskwarrior/utils.py +++ b/todoist_taskwarrior/utils.py @@ -86,13 +86,16 @@ def parse_recur(date_string): # - trim leading, trailing, and, duplicate spaces # - convert to lowercase date_string = ' '.join(date_string.lower().strip().split()) - return ( + result = ( _recur_single_cycle(date_string) or _recur_multi_cycle(date_string) or _recur_day_of_week(date_string) or _recur_day_of_month(date_string) or _recur_special(date_string) ) + if not result: + raise Exception("Recurrence not supported: %s" % date_string) + return result # Atoms