From 759f98388a15943fa4dec444fb91adbf7a22b656 Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Mon, 9 Oct 2023 14:13:02 +0200 Subject: [PATCH] Add some __eq__ Needed as 088eea7 adds comparison of elements this makes sure that they are compared by value instead of by reference. --- CHANGES.rst | 2 ++ src/icalendar/prop.py | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 5d523cf..6fc2981 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -28,6 +28,8 @@ Bug fixes: [jacadzaca] - Use non legacy timezone name. Ref: #567 +- Add some compare functions. + Ref: #568 5.0.10 (unreleased) ------------------- diff --git a/src/icalendar/prop.py b/src/icalendar/prop.py index 83c9048..131567f 100644 --- a/src/icalendar/prop.py +++ b/src/icalendar/prop.py @@ -257,6 +257,11 @@ class vDDDLists: out.append(vDDDTypes.from_ical(ical_dt, timezone=timezone)) return out + def __eq__(self, other): + if not isinstance(other, vDDDLists): + return False + return self.dts == other.dts + class vCategory: @@ -865,6 +870,11 @@ class vUTCOffset: return -offset return offset + def __eq__(self, other): + if not isinstance(other, vUTCOffset): + return False + return self.td == other.td + class vInline(str): """This is an especially dumb class that just holds raw unparsed text and