gweis / isodate

ISO 8601 date/time parser
BSD 3-Clause "New" or "Revised" License
148 stars 58 forks source link

isodate.duration_isoformat does not raise Exception for wrong input type #56

Open GiorgioBalestrieri opened 5 years ago

GiorgioBalestrieri commented 5 years ago

Hi,

I just noticed that isodate.duration_isoformat does not raise an Exception if invalid inputs are passed, even if the type is wrong. Instead, it returns 'P%P'. I don't know the internals, but a check on the validity of the inputs would make this much safer.

>>> isodate.duration_isoformat('ajaksdf')
'P%P'
>>> isodate.duration_isoformat(1000)
'P%P'