Skip to content

Commit

Permalink
Add tests for #62 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
niccokunzmann committed Jul 5, 2023
1 parent cf62f9e commit fa3cb19
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 1 deletion.
79 changes: 79 additions & 0 deletions test/calendars/issue-62-moved-event-2.ics
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:Test Calendar
X-WR-TIMEZONE:Australia/Sydney
BEGIN:VTIMEZONE
TZID:Australia/Sydney
X-LIC-LOCATION:Australia/Sydney
BEGIN:STANDARD
TZOFFSETFROM:+1100
TZOFFSETTO:+1000
TZNAME:AEST
DTSTART:19700405T030000
RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=1SU
END:STANDARD
BEGIN:DAYLIGHT
TZOFFSETFROM:+1000
TZOFFSETTO:+1100
TZNAME:AEDT
DTSTART:19701004T020000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=1SU
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
DTSTART;TZID=Australia/Sydney:20230808T140000
DTEND;TZID=Australia/Sydney:20230808T150000
RRULE:FREQ=WEEKLY;WKST=SU;UNTIL=20230828T135959Z;BYDAY=TU
DTSTAMP:20230629T040023Z
UID:7v3ju5ft4je5iq18nfdk2s3spk@google.com
CREATED:20230629T035454Z
LAST-MODIFIED:20230629T035851Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Datetime
TRANSP:OPAQUE
END:VEVENT
BEGIN:VEVENT
DTSTART;TZID=Australia/Sydney:20230814T140000
DTEND;TZID=Australia/Sydney:20230814T150000
DTSTAMP:20230629T040023Z
UID:7v3ju5ft4je5iq18nfdk2s3spk@google.com
RECURRENCE-ID;TZID=Australia/Sydney:20230815T140000
CREATED:20230629T035454Z
LAST-MODIFIED:20230629T035851Z
SEQUENCE:1
STATUS:CONFIRMED
SUMMARY:Datetime
TRANSP:OPAQUE
END:VEVENT
BEGIN:VEVENT
DTSTART;VALUE=DATE:20230810
DTEND;VALUE=DATE:20230811
RRULE:FREQ=WEEKLY;WKST=SU;UNTIL=20230830;BYDAY=TH
DTSTAMP:20230629T040023Z
UID:6ep37v20d728v14rcgn17v9is6@google.com
CREATED:20230629T035522Z
LAST-MODIFIED:20230629T035854Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:All Day
TRANSP:TRANSPARENT
END:VEVENT
BEGIN:VEVENT
DTSTART;VALUE=DATE:20230816
DTEND;VALUE=DATE:20230817
DTSTAMP:20230629T040023Z
UID:6ep37v20d728v14rcgn17v9is6@google.com
RECURRENCE-ID;VALUE=DATE:20230817
CREATED:20230629T035522Z
LAST-MODIFIED:20230629T035854Z
SEQUENCE:1
STATUS:CONFIRMED
SUMMARY:All Day
TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR

30 changes: 29 additions & 1 deletion test/test_issue_62_moved_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Issue: https://github.com/niccokunzmann/python-recurring-ical-events/issues/62
'''
import pytest


def test_event_is_absent(calendars):
'''RRULE:FREQ=MONTHLY;BYDAY=-1FR'''
Expand All @@ -19,6 +21,32 @@ def test_there_is_only_one_event_in_december(calendars):
events = calendars.issue_62_moved_event.at((2021, 12))
assert len(events) == 1


@pytest.mark.parametrize(
"date,summary",
[
("20230810", "All Day"),
("20230816", "All Day"),
("20230824", "All Day"),
("20230808", "Datetime"),
("20230814", "Datetime"),
("20230822", "Datetime"),
]
)
def test_event_is_present(calendars, date, summary):
"""Test that the middle event has moved"""
events = calendars.issue_62_moved_event_2.at(date)
assert len(events) == 1
event = events[0]
assert event["SUMMARY"] == summary

@pytest.mark.parametrize("date", ["20230815", "20230817"])
def test_event_is_absent(calendars, date):
"""We make sure that the moved event is not there."""
events = calendars.issue_62_moved_event_2.at(date)
assert len(events) == 0

def test_total_amount_of_events(calendars):
"""There are only 6 events!"""
events = calendars.issue_62_moved_event_2.at((2023, 8))
assert len(events) == 6

0 comments on commit fa3cb19

Please sign in to comment.