Skip to content

Commit

Permalink
Add files to test SUMMARY
Browse files Browse the repository at this point in the history
  • Loading branch information
niccokunzmann committed Aug 31, 2024
1 parent 3f0af7b commit 17c4058
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
29 changes: 29 additions & 0 deletions test/calendars/issue_75_range_parameter.ics
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:RESERVAS 1.0//EN
BEGIN:VEVENT
UID:210
DTSTART:20240901T120000Z
DTEND:20240901T140000Z
RRULE:FREQ=DAILY;INTERVAL=2;UNTIL=20250920
RDATE:20240924T090000Z
SEQUENCE:0
SUMMARY:ORIGINAL EVENT
END:VEVENT
BEGIN:VEVENT
UID:210
RECURRENCE-ID;RANGE=THISANDFUTURE:20240913T090000Z
DTSTART:20240913T090000Z
DTEND:20240913T160000Z
SEQUENCE:1
SUMMARY:MODIFIED EVENT
END:VEVENT
BEGIN:VEVENT
UID:210
RECURRENCE-ID;RANGE=THISANDFUTURE:20240923T090000Z
DTSTART:20240923T090000Z
DTEND:20240923T160000Z
SEQUENCE:1
SUMMARY:EDITED EVENT
END:VEVENT
END:VCALENDAR
3 changes: 2 additions & 1 deletion test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ def walk(*args, **kw):
return self._of(calendar)


if hasattr(icalendar, 'use_pytz') and hasattr(icalendar, 'use_zoneinfo'):
if hasattr(icalendar, "use_pytz") and hasattr(icalendar, "use_zoneinfo"):
tzps = [icalendar.use_pytz, icalendar.use_zoneinfo]
else:
tzps = [lambda: ...]


@pytest.fixture(params=tzps, scope="module")
def tzp(request):
"""The timezone provider supported by icalendar."""
Expand Down
28 changes: 28 additions & 0 deletions test/test_issue_75_range_parameter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""This tests the range parameter for ics file.
see https://github.com/niccokunzmann/python-recurring-ical-events/issues/75
"""

import pytest


@pytest.mark.parametrize(
("date", "summary"),
[
("20240901", "ORGINAL EVENT"),
("20240911", "ORGINAL EVENT"),
("20240913", "MODIFIED EVENT"),
("20240915", "MODIFIED EVENT"),
("20240917", "MODIFIED EVENT"),
("20240919", "MODIFIED EVENT"),
("20240921", "MODIFIED EVENT"),
("20240923", "EDITED EVENT"),
("20240924", "EDITED EVENT"), # RDATE
("20240925", "EDITED EVENT"),
],
)
def test_issue_75_RANGE_parameter(calendars, date, summary):
events = calendars.issue_75_range_parameter.at(date)
assert len(events) == 1, f"Expecting one event at {date}"
event = events[0]
assert event["SUMMARY"] == summary

0 comments on commit 17c4058

Please sign in to comment.