From 761a1664d9917eed15acdd4776c79e0e50120385 Mon Sep 17 00:00:00 2001 From: Nicco Kunzmann Date: Sat, 2 Nov 2024 13:21:14 +0000 Subject: [PATCH] Test deleting values --- src/icalendar/alarms.py | 6 ++---- .../tests/test_issue_716_alarm_time_computation.py | 8 +++++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/icalendar/alarms.py b/src/icalendar/alarms.py index 9b55e1f0..ff3988fe 100644 --- a/src/icalendar/alarms.py +++ b/src/icalendar/alarms.py @@ -282,8 +282,7 @@ def acknowledge_until(self, dt: Optional[date]) -> None: an event has been acknowledged because of an alarm. All alarms that happen before this time count as ackknowledged. """ - if dt is not None: - self._last_ack = tzp.localize_utc(dt) + self._last_ack = tzp.localize_utc(dt) if dt is not None else None def snooze_until(self, dt: Optional[date]) -> None: """This is the time in UTC when all the alarms of this component were snoozed. @@ -293,8 +292,7 @@ def snooze_until(self, dt: Optional[date]) -> None: The alarms are supposed to turn up again at dt when they are not acknowledged but snoozed. """ - if dt is not None: - self._snooze_until = tzp.localize_utc(dt) + self._snooze_until = tzp.localize_utc(dt) if dt is not None else None def set_local_timezone(self, tzinfo:Optional[tzinfo|str]): """Set the local timezone. diff --git a/src/icalendar/tests/test_issue_716_alarm_time_computation.py b/src/icalendar/tests/test_issue_716_alarm_time_computation.py index 376deebe..e24a2fbb 100644 --- a/src/icalendar/tests/test_issue_716_alarm_time_computation.py +++ b/src/icalendar/tests/test_issue_716_alarm_time_computation.py @@ -338,4 +338,10 @@ def test_rfc_9074_alarm_times(events, event_index, alarm_times): def test_set_to_None(): """acknowledge_until, snooze_until, set_local_timezone.""" - pytest.skip("TODO") + a = Alarms() + a.set_start(None) + a.set_end(None) + a.set_local_timezone(None) + a.acknowledge_until(None) + a.snooze_until(None) + assert vars(a) == vars(Alarms()) \ No newline at end of file