diff --git a/CHANGES.rst b/CHANGES.rst index 3707365..54583fa 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -13,11 +13,15 @@ Fixes: - Fixed possible IndexError exception during parsing of an ical string. [stlaz] -- Fixed date-time being recognized as date or time during parsing. Added - better error handling to parsing from ical strings. +- When doing a boolean test on ``icalendar.cal.Component``, always return ``True``. + Before it was returning ``False`` due to CaselessDict, if it didn't contain any items. [stlaz] -- Added __version__ attribute to init.py +- Fixed date-time being recognized as date or time during parsing. + Added better error handling to parsing from ical strings. + [stlaz] + +- Added __version__ attribute to init.py. [TomTry] - Documentation fixes. diff --git a/src/icalendar/cal.py b/src/icalendar/cal.py index 4c9e917..7ded8a3 100644 --- a/src/icalendar/cal.py +++ b/src/icalendar/cal.py @@ -94,8 +94,7 @@ class Component(CaselessDict): # return name in not_compliant def __bool__(self): - """ - Returns True, CaselessDict would return False if it had no items + """Returns True, CaselessDict would return False if it had no items. """ return True @@ -103,10 +102,9 @@ class Component(CaselessDict): __nonzero__ = __bool__ def is_empty(self): + """Returns True if Component has no items or subcomponents, else False. """ - Returns True if Component has no items or subcomponents, else False - """ - return True if not (list(self.values()) + self.subcomponents) else False + return True if not (list(self.values()) + self.subcomponents) else False # noqa ############################# # handling of property values