From 0368e16faad09f57d8a6e39480cd29a916c8a1c6 Mon Sep 17 00:00:00 2001 From: Christian Geier Date: Thu, 23 Mar 2017 00:23:01 +0100 Subject: [PATCH] Reproduce #217 --- src/icalendar/tests/test_timezoned.py | 10 ++++++++ src/icalendar/tests/timezone_same_start.ics | 27 +++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/icalendar/tests/timezone_same_start.ics diff --git a/src/icalendar/tests/test_timezoned.py b/src/icalendar/tests/test_timezoned.py index a24402b0..858e4d56 100644 --- a/src/icalendar/tests/test_timezoned.py +++ b/src/icalendar/tests/test_timezoned.py @@ -318,3 +318,13 @@ class TestTimezoneCreation(unittest.TestCase): ), tz._tzinfos.keys() ) + + def test_same_start_date(self): + """testing if we can handle VTIMEZONEs whose different components + have the same start DTIMEs.""" + directory = os.path.dirname(__file__) + with open(os.path.join(directory, 'timezone_same_start.ics'), 'rb') as fp: + data = fp.read() + cal = icalendar.Calendar.from_ical(data) + d = cal.subcomponents[1]['DTSTART'].dt + self.assertEqual(d.strftime('%c'), 'Fri Feb 24 12:00:00 2017') diff --git a/src/icalendar/tests/timezone_same_start.ics b/src/icalendar/tests/timezone_same_start.ics new file mode 100644 index 00000000..a221ae36 --- /dev/null +++ b/src/icalendar/tests/timezone_same_start.ics @@ -0,0 +1,27 @@ +BEGIN:VCALENDAR +VERSION:2.0 +PRODID:Microsoft Exchange Server 2010 +METHOD:REQUEST +BEGIN:VTIMEZONE +TZID:Pacific Standard Time +BEGIN:STANDARD +DTSTART:16010101T020000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11 +TZOFFSETFROM:-0700 +TZOFFSETTO:-0800 +END:STANDARD +BEGIN:DAYLIGHT +DTSTART:16010101T020000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3 +TZOFFSETFROM:-0800 +TZOFFSETTO:-0700 +END:DAYLIGHT +END:VTIMEZONE +BEGIN:VEVENT +SUMMARY;LANGUAGE=en-US:Test 4 +DTSTART;TZID="Pacific Standard Time":20170224T120000 +DTEND;TZID="Pacific Standard Time":20170224T123000 +DTSTAMP:20170224T180431Z +UID:040000008200E00074C5B7101A82E0080000000090E19664858ED20100000000000000 +END:VEVENT +END:VCALENDAR