-
-
Notifications
You must be signed in to change notification settings - Fork 180
Open
Description
icalendar/src/icalendar/attr.py
Lines 956 to 960 in 2f6ce64
if duration is not default and not isinstance(duration, timedelta): | |
raise InvalidCalendar( | |
f"DURATION must be a timedelta, not {type(duration).__name__}." | |
) | |
return None |
While reading the source code I think I found a little error.
If the duration property exist (so it’s not default
object) and it’s already a timedelta
instance, then currently None
is returned.
Maybe it should be something like that:
if isinstance(duration, timedelta): # it cannot be default as default is not a timedelta instance
return duration
elif duration is not default:
raise InvalidCalendar(
f"DURATION must be a timedelta, not {type(duration).__name__}."
)
return None
But maybe I didn’t understand the code correctly…
Metadata
Metadata
Assignees
Labels
No labels