Skip to content

Commit

Permalink
Test deleting values
Browse files Browse the repository at this point in the history
  • Loading branch information
niccokunzmann committed Nov 2, 2024
1 parent 3a61ba0 commit 761a166
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/icalendar/alarms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
8 changes: 7 additions & 1 deletion src/icalendar/tests/test_issue_716_alarm_time_computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

0 comments on commit 761a166

Please sign in to comment.