Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#321 - tz component conversion to pytz time zone fails #379

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/icalendar/tests/issue_321_assert_dst_offset_is_not_false.ics
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//PIMUTILS.ORG//NONSGML khal / icalendar //EN
BEGIN:VTIMEZONE
TZID:Europe/Berlin
BEGIN:DAYLIGHT
DTSTART;VALUE=DATE-TIME:20200329T030000
TZNAME:CEST
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
SUMMARY:Reifenwechsel
DTSTART;TZID=Europe/Berlin;VALUE=DATE-TIME:20200403T102000
DTEND;TZID=Europe/Berlin;VALUE=DATE-TIME:20200403T113000
DTSTAMP;VALUE=DATE-TIME:20200326T165608Z
UID:TCK6EMQBQHQ8KB4PDQPT04Q7HBYNS2MEPZMO
SEQUENCE:0
LOCATION:Musterhausen
END:VEVENT
END:VCALENDAR
14 changes: 14 additions & 0 deletions src/icalendar/tests/test_fixed_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,20 @@ def test_issue_237(self):
self.assertEqual(dtstart.tzinfo.zone, expected_zone)
self.assertEqual(dtstart.tzname(), expected_tzname)

def test_issue_321_assert_dst_offset_is_not_false(self):
"""This tests the assertion hitting for a calendar.

See https://github.com/collective/icalendar/issues/321
"""
directory = os.path.dirname(__file__)
path = os.path.join(directory,
'issue_321_assert_dst_offset_is_not_false.ics')
with open(path, 'rb') as ics:
cal = icalendar.Calendar.from_ical(ics.read())
timezone = list(cal.walk())[1]
print(timezone)
pytz = timezone.to_tz() # assertion should fail

def test_issue_345(self):
"""Issue #345 - Why is tools.UIDGenerator a class (that must be instantiated) instead of a module? """
uid1 = icalendar.tools.UIDGenerator.uid()
Expand Down