kopia lustrzana https://github.com/jazzband/icalevents
tests: add test for #110
rodzic
dd82ba2111
commit
d1c11aa2e0
test
|
@ -0,0 +1,93 @@
|
|||
BEGIN:VCALENDAR
|
||||
METHOD:PUBLISH
|
||||
PRODID:Microsoft Exchange Server 2010
|
||||
VERSION:2.0
|
||||
X-WR-CALNAME:Calendar
|
||||
BEGIN:VTIMEZONE
|
||||
TZID:Eastern Standard Time
|
||||
BEGIN:STANDARD
|
||||
DTSTART:16010101T020000
|
||||
TZOFFSETFROM:-0400
|
||||
TZOFFSETTO:-0500
|
||||
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
|
||||
END:STANDARD
|
||||
BEGIN:DAYLIGHT
|
||||
DTSTART:16010101T020000
|
||||
TZOFFSETFROM:-0500
|
||||
TZOFFSETTO:-0400
|
||||
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
|
||||
END:DAYLIGHT
|
||||
END:VTIMEZONE
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Recurring Event - Exception
|
||||
UID:040000008200E00074C5B7101A82E00800000000D09EB37A5746D701000000000000000
|
||||
0100000006FB97C329EB9D24C92583A1089CDEFE7
|
||||
RECURRENCE-ID;TZID=Eastern Standard Time:20220309T130000
|
||||
SUMMARY:Recurring Event - Exception 1
|
||||
DTSTART;TZID=Eastern Standard Time:20220309T130000
|
||||
DTEND;TZID=Eastern Standard Time:20220309T140000
|
||||
CLASS:PUBLIC
|
||||
PRIORITY:5
|
||||
DTSTAMP:20220330T141405Z
|
||||
TRANSP:OPAQUE
|
||||
STATUS:CONFIRMED
|
||||
SEQUENCE:8
|
||||
LOCATION:Microsoft Teams Meeting
|
||||
X-MICROSOFT-CDO-APPT-SEQUENCE:8
|
||||
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
|
||||
X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
|
||||
X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
|
||||
X-MICROSOFT-CDO-IMPORTANCE:1
|
||||
X-MICROSOFT-CDO-INSTTYPE:3
|
||||
X-MICROSOFT-DONOTFORWARDMEETING:FALSE
|
||||
X-MICROSOFT-DISALLOW-COUNTER:FALSE
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Recurring Event
|
||||
RRULE:FREQ=MONTHLY;UNTIL=20220914T170000Z;INTERVAL=1;BYDAY=2WE
|
||||
UID:040000008200E00074C5B7101A82E00800000000D09EB37A5746D701000000000000000
|
||||
0100000006FB97C329EB9D24C92583A1089CDEFE7
|
||||
SUMMARY:Recurring Event
|
||||
DTSTART;TZID=Eastern Standard Time:20220309T130000
|
||||
DTEND;TZID=Eastern Standard Time:20220309T140000
|
||||
CLASS:PUBLIC
|
||||
PRIORITY:5
|
||||
DTSTAMP:20220330T141405Z
|
||||
TRANSP:OPAQUE
|
||||
STATUS:CONFIRMED
|
||||
SEQUENCE:0
|
||||
LOCATION:Microsoft Teams Meeting
|
||||
X-MICROSOFT-CDO-APPT-SEQUENCE:0
|
||||
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
|
||||
X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
|
||||
X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
|
||||
X-MICROSOFT-CDO-IMPORTANCE:1
|
||||
X-MICROSOFT-CDO-INSTTYPE:1
|
||||
X-MICROSOFT-DONOTFORWARDMEETING:FALSE
|
||||
X-MICROSOFT-DISALLOW-COUNTER:FALSE
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION:Recurring Event - Exception
|
||||
UID:040000008200E00074C5B7101A82E00800000000D09EB37A5746D701000000000000000
|
||||
0100000006FB97C329EB9D24C92583A1089CDEFE7
|
||||
RECURRENCE-ID;TZID=Eastern Standard Time:20220413T130000
|
||||
SUMMARY:Recurring Event - Exception 2
|
||||
DTSTART;TZID=Eastern Standard Time:20220413T103000
|
||||
DTEND;TZID=Eastern Standard Time:20220413T113000
|
||||
CLASS:PUBLIC
|
||||
PRIORITY:5
|
||||
DTSTAMP:20220330T141405Z
|
||||
TRANSP:OPAQUE
|
||||
STATUS:CONFIRMED
|
||||
SEQUENCE:12
|
||||
LOCATION:Microsoft Teams Meeting
|
||||
X-MICROSOFT-CDO-APPT-SEQUENCE:12
|
||||
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
|
||||
X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
|
||||
X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
|
||||
X-MICROSOFT-CDO-IMPORTANCE:1
|
||||
X-MICROSOFT-CDO-INSTTYPE:3
|
||||
X-MICROSOFT-DONOTFORWARDMEETING:FALSE
|
||||
X-MICROSOFT-DISALLOW-COUNTER:FALSE
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
|
@ -873,6 +873,35 @@ class ICalEventsTests(unittest.TestCase):
|
|||
|
||||
self.assertEqual(len(events), 1, "1 events")
|
||||
|
||||
def test_recurr_id_dtstart_missmatch(self):
|
||||
ical = "test/test_data/recurr_id_dtstart_missmatch.ics"
|
||||
tz = gettz("America/New_York")
|
||||
start = date(2022, 3, 1)
|
||||
end = date(2022, 6, 30)
|
||||
|
||||
evs = icalevents.events(file=ical, start=start, end=end)
|
||||
|
||||
# input file isn't in sorted order, so dates are out of order
|
||||
evs.sort(key=lambda ev: (ev.start, ev.sequence))
|
||||
|
||||
self.assertEqual(len(evs), 4)
|
||||
|
||||
# time didn't change, but description/summary did
|
||||
self.assertEqual(evs[0].start, datetime(2022, 3, 9, 13, 00, 0, tzinfo=tz))
|
||||
self.assertEqual(evs[0].summary, "Recurring Event - Exception 1")
|
||||
|
||||
# time/description/summary changed
|
||||
self.assertEqual(evs[1].start, datetime(2022, 4, 13, 10, 30, 0, tzinfo=tz))
|
||||
self.assertEqual(evs[1].summary, "Recurring Event - Exception 2")
|
||||
|
||||
# normally scheduled event
|
||||
self.assertEqual(evs[2].start, datetime(2022, 5, 11, 13, 00, 0, tzinfo=tz))
|
||||
self.assertEqual(evs[2].summary, "Recurring Event")
|
||||
|
||||
# normally scheduled event
|
||||
self.assertEqual(evs[3].start, datetime(2022, 6, 8, 13, 00, 0, tzinfo=tz))
|
||||
self.assertEqual(evs[3].summary, "Recurring Event")
|
||||
|
||||
def test_regression_repeating_events_raise_an_error(self):
|
||||
ical = "test/test_data/recurrence_tzinfo.ics"
|
||||
start = date(2023, 1, 1)
|
||||
|
|
Ładowanie…
Reference in New Issue