Skip to content

Commit

Permalink
add test cases
Browse files Browse the repository at this point in the history
the test cases cover those mentioned in #27
  • Loading branch information
niccokunzmann committed Jun 14, 2020
1 parent 7678272 commit f833808
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 0 deletions.
42 changes: 42 additions & 0 deletions test/calendars/issue-27-t1.ics
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
BEGIN:VCALENDAR
METHOD:PUBLISH
PRODID:Microsoft Exchange Server 2010
VERSION:2.0
X-WR-CALNAME:Events
X-EVOLUTION-DATA-REVISION:2020-04-23T17:43:39.112248Z(2)
BEGIN:VTIMEZONE
TZID:W. Europe Standard Time
BEGIN:STANDARD
DTSTART:16010101T030000
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T020000
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
END:DAYLIGHT
END:VTIMEZONE

BEGIN:VEVENT
UID:3bbe38c205956551730fc9233525fe268296ec02
DTSTAMP:20200423T174240Z
DTSTART;TZID=/freeassociation.sourceforge.net/Europe/Berlin:
20200426T140000
DTEND;TZID=/freeassociation.sourceforge.net/Europe/Berlin:
20200426T143000
SUMMARY:Reoccur
SEQUENCE:7
X-LIC-ERROR;X-LIC-ERRORTYPE=VALUE-PARSE-ERROR:No value for DESCRIPTION
property. Removing entire property:
CREATED:20200423T174316Z
LAST-MODIFIED:20200423T174339Z
X-LIC-ERROR;X-LIC-ERRORTYPE=VALUE-PARSE-ERROR:No value for DESCRIPTION
property. Removing entire property:
RRULE:FREQ=DAILY;UNTIL=20200429T000000
EXDATE:20200427T120000Z

END:VEVENT
END:VCALENDAR
42 changes: 42 additions & 0 deletions test/calendars/issue-27-t2.ics
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
BEGIN:VCALENDAR
METHOD:PUBLISH
PRODID:Microsoft Exchange Server 2010
VERSION:2.0
X-WR-CALNAME:Events
X-EVOLUTION-DATA-REVISION:2020-04-23T17:43:39.112248Z(2)
BEGIN:VTIMEZONE
TZID:W. Europe Standard Time
BEGIN:STANDARD
DTSTART:16010101T030000
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T020000
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
END:DAYLIGHT
END:VTIMEZONE

BEGIN:VEVENT
UID:3bbe38c205956551730fc9233525fe268296ec02
DTSTAMP:20200423T174240Z
DTSTART;TZID=/freeassociation.sourceforge.net/Europe/Berlin:
20200426T140000
DTEND;TZID=/freeassociation.sourceforge.net/Europe/Berlin:
20200426T143000
SUMMARY:Reoccur
SEQUENCE:7
X-LIC-ERROR;X-LIC-ERRORTYPE=VALUE-PARSE-ERROR:No value for DESCRIPTION
property. Removing entire property:
CREATED:20200423T174316Z
LAST-MODIFIED:20200423T174339Z
X-LIC-ERROR;X-LIC-ERRORTYPE=VALUE-PARSE-ERROR:No value for DESCRIPTION
property. Removing entire property:
RRULE:FREQ=DAILY;UNTIL=20200429T000000Z
EXDATE:20200427T120000Z

END:VEVENT
END:VCALENDAR
31 changes: 31 additions & 0 deletions test/test_issue_27.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""These tests are for Issue 27
https://github.com/niccokunzmann/python-recurring-ical-events/issues/27
"""

start_date = (2020, 4, 25)
end_date = (2020, 4, 30)

def print_events(events):
for event in events:
start = event["DTSTART"].dt
duration = event["DTEND"].dt - event["DTSTART"].dt
print("start {} duration {}".format(start, duration))


def test_until_value_with_unknown_timezone_works_with_exdate(calendars):
"""The until value has no time zone attached."""
events = calendars.issue_27_t1.between(start_date, end_date)
print_events(events)
assert len(events) == 2, "two events, exdate matches one"


def test_until_value_with_default_timezone_works_with_exdate(calendars):
"""The until value uses the default time zone."""
events = calendars.issue_27_t2.between(start_date, end_date)
print_events(events)
assert len(events) == 2, "two events, exdate matches one"




0 comments on commit f833808

Please sign in to comment.