mirror of
https://git.webmeisterei.com/webmeisterei/todoist-taskwarrior.git
synced 2023-12-21 10:23:00 +01:00
Raise error for unsupported recurrence for specific weekdays - e.g. every mon,tues,weds
This commit is contained in:
parent
1ec6da17b3
commit
c4815955ef
@ -169,5 +169,9 @@ def test_annually():
|
|||||||
|
|
||||||
|
|
||||||
def test_unsupported():
|
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')
|
||||||
|
|
||||||
|
@ -86,13 +86,16 @@ def parse_recur(date_string):
|
|||||||
# - trim leading, trailing, and, duplicate spaces
|
# - trim leading, trailing, and, duplicate spaces
|
||||||
# - convert to lowercase
|
# - convert to lowercase
|
||||||
date_string = ' '.join(date_string.lower().strip().split())
|
date_string = ' '.join(date_string.lower().strip().split())
|
||||||
return (
|
result = (
|
||||||
_recur_single_cycle(date_string) or
|
_recur_single_cycle(date_string) or
|
||||||
_recur_multi_cycle(date_string) or
|
_recur_multi_cycle(date_string) or
|
||||||
_recur_day_of_week(date_string) or
|
_recur_day_of_week(date_string) or
|
||||||
_recur_day_of_month(date_string) or
|
_recur_day_of_month(date_string) or
|
||||||
_recur_special(date_string)
|
_recur_special(date_string)
|
||||||
)
|
)
|
||||||
|
if not result:
|
||||||
|
raise Exception("Recurrence not supported: %s" % date_string)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
# Atoms
|
# Atoms
|
||||||
|
Loading…
Reference in New Issue
Block a user