Skip to content

Commit 9d0d2e8

Browse files
committed
Test date-only EXDATE with multiple instances per day
1 parent a0161c7 commit 9d0d2e8

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

‎tests/khalendar_utils_test.py‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,21 @@ def test_expand_rrule_notz_until_z(self):
759759
END:VCALENDAR
760760
"""
761761

762+
event_exdate_d_multi = """BEGIN:VCALENDAR
763+
VERSION:2.0
764+
BEGIN:VEVENT
765+
UID:event_exdate_d_multi123
766+
DTSTAMP:20140627T162546Z
767+
DTSTART;TZID=Europe/Berlin:20140702T080000
768+
DTEND;TZID=Europe/Berlin:20140702T083000
769+
SUMMARY:Test event
770+
RRULE:FREQ=HOURLY;INTERVAL=8;COUNT=9
771+
EXDATE;VALUE=DATE:20140703
772+
EXDATE;TZID=Europe/Berlin:20140704T080000
773+
END:VEVENT
774+
END:VCALENDAR
775+
"""
776+
762777
latest_bug = """BEGIN:VCALENDAR
763778
VERSION:2.0
764779
BEGIN:VEVENT
@@ -862,6 +877,19 @@ def test_event_exdate_ds(self):
862877
assert dtstart[0][0] == dt.date(2014, 7, 2)
863878
assert dtstart[-1][0] == dt.date(2014, 7, 11)
864879

880+
def test_event_exdate_d_multiple_instances_per_day(self):
881+
"""a date EXDATE excludes all instances on that day, a datetime one
882+
only the matching instance"""
883+
vevent = _get_vevent(event_exdate_d_multi)
884+
dtstart = [start for start, _ in icalendar_helpers.expand(vevent, berlin)]
885+
assert dtstart == [
886+
berlin.localize(dt.datetime(2014, 7, 2, 8)),
887+
berlin.localize(dt.datetime(2014, 7, 2, 16)),
888+
berlin.localize(dt.datetime(2014, 7, 4, 0)),
889+
berlin.localize(dt.datetime(2014, 7, 4, 16)),
890+
berlin.localize(dt.datetime(2014, 7, 5, 0)),
891+
]
892+
865893
def test_event_exdates_remove(self):
866894
"""check if we can remove one more instance"""
867895
vevent = _get_vevent(event_exdatesl_dt)

0 commit comments

Comments
 (0)