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

5.0.12 [BUG]: test suite fails in multiple units with pytest 8.2.1 #617

Closed
kloczek opened this issue May 27, 2024 · 4 comments
Closed

5.0.12 [BUG]: test suite fails in multiple units with pytest 8.2.1 #617

kloczek opened this issue May 27, 2024 · 4 comments

Comments

@kloczek
Copy link
Contributor

kloczek commented May 27, 2024

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix> using installer module
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-icalendar-5.0.12-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-icalendar-5.0.12-2.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network' src/icalendar/tests
============================= test session starts ==============================
platform linux -- Python 3.10.14, pytest-8.2.1, pluggy-1.5.0
rootdir: /home/tkloczko/rpmbuild/BUILD/icalendar-5.0.12
configfile: setup.cfg
plugins: hypothesis-6.100.0
collected 872 items

src/icalendar/tests/fuzzed/test_fuzzed_calendars.py s                    [  0%]
src/icalendar/tests/test_cli_tool.py F                                   [  0%]
src/icalendar/tests/test_components_break_on_bad_ics.py .......          [  1%]
src/icalendar/tests/test_encoding.py .........FF......                   [  2%]
src/icalendar/tests/test_equality.py ................................... [  6%]
........................................................................ [ 15%]
........................................................................ [ 23%]
........................................................................ [ 31%]
........................................................................ [ 40%]
.........................................                                [ 44%]
src/icalendar/tests/test_examples.py ....F                               [ 45%]
src/icalendar/tests/test_icalendar.py .......                            [ 46%]
src/icalendar/tests/test_issue_116.py .                                  [ 46%]
src/icalendar/tests/test_issue_165_missing_event.py .                    [ 46%]
src/icalendar/tests/test_issue_168_parsing_invalid_calendars_no_warning.py . [ 46%]
                                                                         [ 46%]
src/icalendar/tests/test_issue_27_period.py .                            [ 46%]
src/icalendar/tests/test_issue_318_skip_default_parameters.py ...        [ 46%]
src/icalendar/tests/test_issue_322_single_strings_characters_split_into_multiple_categories.py . [ 47%]
                                                                         [ 47%]
src/icalendar/tests/test_issue_348_exception_parsing_value.py ..         [ 47%]
src/icalendar/tests/test_issue_500_vboolean_for_parameter.py .           [ 47%]
src/icalendar/tests/test_issue_557_encode_native_parameters.py ........  [ 48%]
src/icalendar/tests/test_multiple.py .                                   [ 48%]
src/icalendar/tests/test_oss_fuzz_errors.py ..                           [ 48%]
src/icalendar/tests/test_parsing.py ..........F...................FF..F. [ 52%]
F..F.....                                                                [ 53%]
src/icalendar/tests/test_period.py FFFF......................            [ 56%]
src/icalendar/tests/test_property_params.py ....................         [ 59%]
src/icalendar/tests/test_recurrence.py ......................FFFFF...... [ 62%]
...                                                                      [ 63%]
src/icalendar/tests/test_time.py ..                                      [ 63%]
src/icalendar/tests/test_timezoned.py .FF..F....                         [ 64%]
src/icalendar/tests/test_unit_cal.py ...................F............... [ 68%]
.........................................................                [ 75%]
src/icalendar/tests/test_unit_caselessdict.py ....                       [ 75%]
src/icalendar/tests/test_unit_parser_tools.py ..                         [ 75%]
src/icalendar/tests/test_unit_prop.py ........F.....................F... [ 79%]
..........................F............................................. [ 87%]
.................................                                        [ 91%]
src/icalendar/tests/test_unit_tools.py ..........                        [ 92%]
src/icalendar/tests/test_with_doctest.py ............................... [ 96%]
...............................                                          [100%]

=================================== FAILURES ===================================
______________________ CLIToolTest.test_output_is_proper _______________________

self = <icalendar.tests.test_cli_tool.CLIToolTest testMethod=test_output_is_proper>

    def test_output_is_proper(self):
        self.maxDiff = None
        calendar = Calendar.from_ical(INPUT)
        output = ''
        for event in calendar.walk('vevent'):
            output += cli.view(event) + '\n\n'
>       self.assertEqual(PROPER_OUTPUT, output)
E       AssertionError: '    [192 chars]g 20 08:34:00 2022\n    End        : Sat Aug 2[835 chars]\n\n' != '    [192 chars]g 20 10:34:00 2022\n    End        : Sat Aug 2[835 chars]\n\n'
E             Organizer: organizer <organizer@test.test>
E             Attendees:
E              attendee1 <attendee1@example.com>
E              attendee2 <attendee2@test.test>
E             Summary    : Test Summary
E       -     Starts     : Sat Aug 20 08:34:00 2022
E       ?                              -
E       +     Starts     : Sat Aug 20 10:34:00 2022
E       ?                             +
E       -     End        : Sat Aug 20 09:34:00 2022
E       ?                             ^^
E       +     End        : Sat Aug 20 11:34:00 2022
E       ?                             ^^
E             Duration   : 1:00:00
E             Location   : New Amsterdam, 1000 Sunrise Test Street
E             Comment    : Comment
E             Description:
E               Test Description
E
E             Organizer: organizer <organizer@test.test>
E             Attendees:
E              attendee1 <attendee1@example.com>
E              attendee2 <attendee2@test.test>
E             Summary    : Test summary
E       -     Starts     : Sat Aug 20 18:00:00 2022
E       ?                             ^^
E       +     Starts     : Sat Aug 20 20:00:00 2022
E       ?                             ^^
E       -     End        : Sat Aug 20 18:30:00 2022
E       ?                             ^^
E       +     End        : Sat Aug 20 20:30:00 2022
E       ?                             ^^
E             Duration   : 0:30:00
E             Location   : New Amsterdam, 1010 Test Street
E             Comment    :
E             Description:
E              Test Description
E              This one is multiline
E
E             Organizer:
E             Attendees:
E
E             Summary    : TEST
E             Starts     : Wed May 11 00:00:00 2022
E             End        : Mon May 16 00:00:00 2022
E             Duration   : 5 days, 0:00:00
E             Location   :
E             Comment    :
E             Description:

src/icalendar/tests/test_cli_tool.py:101: AssertionError
__________ test_parses_event_with_non_ascii_tzid_issue_237[<lambda>0] __________

calendars = {'_parser': <bound method Component.from_ical of <class 'icalendar.cal.Calendar'>>, '_data_source_folder': '/home/tklo...TC-03:00) Brasília'})), 'DTEND': vDDDTypes(2017-05-11 14:00:00-03:00, Parameters({'TZID': '(UTC-03:00) Brasília'}))}))}
in_timezone = <function <lambda> at 0x7f4c5699e830>

    def test_parses_event_with_non_ascii_tzid_issue_237(calendars, in_timezone):
        """Issue #237 - Fail to parse timezone with non-ascii TZID
        see https://github.com/collective/icalendar/issues/237
        """
        start = calendars.issue_237_fail_to_parse_timezone_with_non_ascii_tzid.walk('VEVENT')[0].decoded('DTSTART')
        expected = in_timezone(datetime.datetime(2017, 5, 11, 13, 30), 'America/Sao_Paulo')
        assert not calendars.issue_237_fail_to_parse_timezone_with_non_ascii_tzid.errors
>       assert start == expected
E       AssertionError: assert datetime.datetime(2017, 5, 11, 13, 30, tzinfo=<DstTzInfo '(UTC-03:00) Brasília' Brasília standard-1 day, 21:00:00 STD>) == datetime.datetime(2017, 5, 11, 13, 30, tzinfo=<StaticTzInfo 'America/Sao_Paulo'>)

src/icalendar/tests/test_encoding.py:42: AssertionError
__________ test_parses_event_with_non_ascii_tzid_issue_237[<lambda>1] __________

calendars = {'_parser': <bound method Component.from_ical of <class 'icalendar.cal.Calendar'>>, '_data_source_folder': '/home/tklo...TC-03:00) Brasília'})), 'DTEND': vDDDTypes(2017-05-11 14:00:00-03:00, Parameters({'TZID': '(UTC-03:00) Brasília'}))}))}
in_timezone = <function <lambda> at 0x7f4c5699e8c0>

    def test_parses_event_with_non_ascii_tzid_issue_237(calendars, in_timezone):
        """Issue #237 - Fail to parse timezone with non-ascii TZID
        see https://github.com/collective/icalendar/issues/237
        """
        start = calendars.issue_237_fail_to_parse_timezone_with_non_ascii_tzid.walk('VEVENT')[0].decoded('DTSTART')
        expected = in_timezone(datetime.datetime(2017, 5, 11, 13, 30), 'America/Sao_Paulo')
        assert not calendars.issue_237_fail_to_parse_timezone_with_non_ascii_tzid.errors
>       assert start == expected
E       AssertionError: assert datetime.datetime(2017, 5, 11, 13, 30, tzinfo=<DstTzInfo '(UTC-03:00) Brasília' Brasília standard-1 day, 21:00:00 STD>) == datetime.datetime(2017, 5, 11, 13, 30, tzinfo=tzfile('/usr/share/zoneinfo/America/Sao_Paulo'))

src/icalendar/tests/test_encoding.py:42: AssertionError
_______________ test_creating_calendar_with_unicode_fields[utc4] _______________

calendars = {'_parser': <bound method Component.from_ical of <class 'icalendar.cal.Calendar'>>, '_data_source_folder': '/home/tklo...'artsprint 2012''), 'DESCRIPTION': vText('b'sprinting at the artsprint''), 'LOCATION': vText('b'aka bild\\, wien'')}))}
utc = tzfile('/usr/share/zoneinfo/UTC')

    def test_creating_calendar_with_unicode_fields(calendars, utc):
        ''' create a calendar with events that contain unicode characters in their fields '''
        cal = Calendar()
        cal.add('PRODID', '-//Plönë.org//NONSGML plone.app.event//EN')
        cal.add('VERSION', '2.0')
        cal.add('X-WR-CALNAME', 'äöü ÄÖÜ €')
        cal.add('X-WR-CALDESC', 'test non ascii: äöü ÄÖÜ €')
        cal.add('X-WR-RELCALID', '12345')

        event = Event()
        event.add('DTSTART', datetime.datetime(2010, 10, 10, 10, 0, 0, tzinfo=utc))
        event.add('DTEND', datetime.datetime(2010, 10, 10, 12, 0, 0, tzinfo=utc))
        event.add('CREATED', datetime.datetime(2010, 10, 10, 0, 0, 0, tzinfo=utc))
        event.add('UID', '123456')
        event.add('SUMMARY', 'Non-ASCII Test: ÄÖÜ äöü €')
        event.add('DESCRIPTION', 'icalendar should be able to de/serialize non-ascii.')
        event.add('LOCATION', 'Tribstrül')
        cal.add_component(event)

        # test_create_event_simple
        event1 = Event()
        event1.add('DTSTART', datetime.datetime(2010, 10, 10, 0, 0, 0, tzinfo=utc))
        event1.add('SUMMARY', 'åäö')
        cal.add_component(event1)

        # test_unicode_parameter_name
        # test for issue #80 https://github.com/collective/icalendar/issues/80
        event2 = Event()
        event2.add('DESCRIPTION', 'äöüßÄÖÜ')
        cal.add_component(event2)

>       assert cal.to_ical() == calendars.created_calendar_with_unicode_fields.raw_ics
E       AssertionError: assert b'BEGIN:VCALE...VCALENDAR\r\n' == b'BEGIN:VCALE...VCALENDAR\r\n'
E
E         At index 247 diff: b';' != b':'
E         Use -v to get more diff

src/icalendar/tests/test_examples.py:39: AssertionError
_____________________ test_timezone_name_parsed_issue_112 ______________________

events = {'_parser': <bound method Component.from_ical of <class 'icalendar.cal.Event'>>, '_data_source_folder': '/home/tkloczk...007-02-21 09:54:12+00:00, Parameters({})), 'SEQUENCE': 0}), 'issue_82_expected_output': VEVENT({'ATTACH': 'dGV4dA=='})}

    def test_timezone_name_parsed_issue_112(events):
        '''Issue #112 - No timezone info on EXDATE

        https://github.com/collective/icalendar/issues/112
        '''
>       assert events.issue_112_missing_tzinfo_on_exdate['exdate'][0].dts[0].dt.tzname() == 'EDT'
E       AssertionError: assert '' == 'EDT'
E
E         - EDT

src/icalendar/tests/test_parsing.py:64: AssertionError
__________ test_no_tzid_when_utc[utc4-date0-DTSTART:20120716T000000Z] __________

utc = tzfile('/usr/share/zoneinfo/UTC')
date = datetime.datetime(2012, 7, 16, 0, 0, tzinfo=tzfile('/usr/share/zoneinfo/UTC'))
expected_output = b'DTSTART:20120716T000000Z'

    @pytest.mark.parametrize('date, expected_output', [
        (datetime(2012, 7, 16, 0, 0, 0), b'DTSTART:20120716T000000Z'),
        (datetime(2021, 11, 17, 15, 9, 15), b'DTSTART:20211117T150915Z')
    ])
    def test_no_tzid_when_utc(utc, date, expected_output):
        '''Issue #58  - TZID on UTC DATE-TIMEs
           Issue #335 - UTC timezone identification is broken

        https://github.com/collective/icalendar/issues/58
        https://github.com/collective/icalendar/issues/335
        '''
        # According to RFC 2445: "The TZID property parameter MUST NOT be
        # applied to DATE-TIME or TIME properties whose time values are
        # specified in UTC.
        date = date.replace(tzinfo=utc)
        event = Event()
        event.add('dtstart', date)
>       assert expected_output in event.to_ical()
E       AssertionError: assert b'DTSTART:20120716T000000Z' in b'BEGIN:VEVENT\r\nDTSTART;TZID=:20120716T000000\r\nEND:VEVENT\r\n'
E        +  where b'BEGIN:VEVENT\r\nDTSTART;TZID=:20120716T000000\r\nEND:VEVENT\r\n' = <bound method Component.to_ical of VEVENT({'DTSTART': vDDDTypes(2012-07-16 00:00:00+00:00, Parameters({'TZID': ''}))})>()
E        +    where <bound method Component.to_ical of VEVENT({'DTSTART': vDDDTypes(2012-07-16 00:00:00+00:00, Parameters({'TZID': ''}))})> = VEVENT({'DTSTART': vDDDTypes(2012-07-16 00:00:00+00:00, Parameters({'TZID': ''}))}).to_ical

src/icalendar/tests/test_parsing.py:143: AssertionError
__________ test_no_tzid_when_utc[utc4-date1-DTSTART:20211117T150915Z] __________

utc = tzfile('/usr/share/zoneinfo/UTC')
date = datetime.datetime(2021, 11, 17, 15, 9, 15, tzinfo=tzfile('/usr/share/zoneinfo/UTC'))
expected_output = b'DTSTART:20211117T150915Z'

    @pytest.mark.parametrize('date, expected_output', [
        (datetime(2012, 7, 16, 0, 0, 0), b'DTSTART:20120716T000000Z'),
        (datetime(2021, 11, 17, 15, 9, 15), b'DTSTART:20211117T150915Z')
    ])
    def test_no_tzid_when_utc(utc, date, expected_output):
        '''Issue #58  - TZID on UTC DATE-TIMEs
           Issue #335 - UTC timezone identification is broken

        https://github.com/collective/icalendar/issues/58
        https://github.com/collective/icalendar/issues/335
        '''
        # According to RFC 2445: "The TZID property parameter MUST NOT be
        # applied to DATE-TIME or TIME properties whose time values are
        # specified in UTC.
        date = date.replace(tzinfo=utc)
        event = Event()
        event.add('dtstart', date)
>       assert expected_output in event.to_ical()
E       AssertionError: assert b'DTSTART:20211117T150915Z' in b'BEGIN:VEVENT\r\nDTSTART;TZID=:20211117T150915\r\nEND:VEVENT\r\n'
E        +  where b'BEGIN:VEVENT\r\nDTSTART;TZID=:20211117T150915\r\nEND:VEVENT\r\n' = <bound method Component.to_ical of VEVENT({'DTSTART': vDDDTypes(2021-11-17 15:09:15+00:00, Parameters({'TZID': ''}))})>()
E        +    where <bound method Component.to_ical of VEVENT({'DTSTART': vDDDTypes(2021-11-17 15:09:15+00:00, Parameters({'TZID': ''}))})> = VEVENT({'DTSTART': vDDDTypes(2021-11-17 15:09:15+00:00, Parameters({'TZID': ''}))}).to_ical

src/icalendar/tests/test_parsing.py:143: AssertionError
____ test_handles_unique_tzid[<lambda>0-issue_466_respect_unique_timezone] _____

calendars = {'_parser': <bound method Component.from_ical of <class 'icalendar.cal.Calendar'>>, '_data_source_folder': '/home/tklo...'artsprint 2012''), 'DESCRIPTION': vText('b'sprinting at the artsprint''), 'LOCATION': vText('b'aka bild\\, wien'')}))}
in_timezone = <function <lambda> at 0x7f4c5699e830>
calendar_name = 'issue_466_respect_unique_timezone'

    @pytest.mark.parametrize('calendar_name', [
        # Issue #466 - [BUG] TZID timezone is ignored when forward-slash is used
        # https://github.com/collective/icalendar/issues/466
        'issue_466_respect_unique_timezone',
        'issue_466_convert_tzid_with_slash'
    ])
    def test_handles_unique_tzid(calendars, in_timezone, calendar_name):
        calendar = calendars[calendar_name]
        start_dt = calendar.walk('VEVENT')[0]['dtstart'].dt
        end_dt = calendar.walk('VEVENT')[0]['dtend'].dt
>       assert start_dt == in_timezone(datetime(2022, 10, 21, 20, 0, 0), 'Europe/Stockholm')
E       AssertionError: assert datetime.datetime(2022, 10, 21, 20, 0, tzinfo=<DstTzInfo '/Europe/CUSTOM' CEST+2:00:00 DST>) == datetime.datetime(2022, 10, 21, 20, 0, tzinfo=<StaticTzInfo 'Europe/Stockholm'>)
E        +  where datetime.datetime(2022, 10, 21, 20, 0, tzinfo=<StaticTzInfo 'Europe/Stockholm'>) = <function <lambda> at 0x7f4c5699e830>(datetime.datetime(2022, 10, 21, 20, 0), 'Europe/Stockholm')
E        +    where datetime.datetime(2022, 10, 21, 20, 0) = datetime(2022, 10, 21, 20, 0, 0)

src/icalendar/tests/test_parsing.py:175: AssertionError
____ test_handles_unique_tzid[<lambda>1-issue_466_respect_unique_timezone] _____

calendars = {'_parser': <bound method Component.from_ical of <class 'icalendar.cal.Calendar'>>, '_data_source_folder': '/home/tklo...'artsprint 2012''), 'DESCRIPTION': vText('b'sprinting at the artsprint''), 'LOCATION': vText('b'aka bild\\, wien'')}))}
in_timezone = <function <lambda> at 0x7f4c5699e8c0>
calendar_name = 'issue_466_respect_unique_timezone'

    @pytest.mark.parametrize('calendar_name', [
        # Issue #466 - [BUG] TZID timezone is ignored when forward-slash is used
        # https://github.com/collective/icalendar/issues/466
        'issue_466_respect_unique_timezone',
        'issue_466_convert_tzid_with_slash'
    ])
    def test_handles_unique_tzid(calendars, in_timezone, calendar_name):
        calendar = calendars[calendar_name]
        start_dt = calendar.walk('VEVENT')[0]['dtstart'].dt
        end_dt = calendar.walk('VEVENT')[0]['dtend'].dt
>       assert start_dt == in_timezone(datetime(2022, 10, 21, 20, 0, 0), 'Europe/Stockholm')
E       AssertionError: assert datetime.datetime(2022, 10, 21, 20, 0, tzinfo=<DstTzInfo '/Europe/CUSTOM' CEST+2:00:00 DST>) == datetime.datetime(2022, 10, 21, 20, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Stockholm'))
E        +  where datetime.datetime(2022, 10, 21, 20, 0, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Stockholm')) = <function <lambda> at 0x7f4c5699e8c0>(datetime.datetime(2022, 10, 21, 20, 0), 'Europe/Stockholm')
E        +    where datetime.datetime(2022, 10, 21, 20, 0) = datetime(2022, 10, 21, 20, 0, 0)

src/icalendar/tests/test_parsing.py:175: AssertionError
____ test_handles_unique_tzid[<lambda>2-issue_466_convert_tzid_with_slash] _____

calendars = {'_parser': <bound method Component.from_ical of <class 'icalendar.cal.Calendar'>>, '_data_source_folder': '/home/tklo...'artsprint 2012''), 'DESCRIPTION': vText('b'sprinting at the artsprint''), 'LOCATION': vText('b'aka bild\\, wien'')}))}
in_timezone = <function <lambda> at 0x7f4c5699e950>
calendar_name = 'issue_466_convert_tzid_with_slash'

    @pytest.mark.parametrize('calendar_name', [
        # Issue #466 - [BUG] TZID timezone is ignored when forward-slash is used
        # https://github.com/collective/icalendar/issues/466
        'issue_466_respect_unique_timezone',
        'issue_466_convert_tzid_with_slash'
    ])
    def test_handles_unique_tzid(calendars, in_timezone, calendar_name):
        calendar = calendars[calendar_name]
        start_dt = calendar.walk('VEVENT')[0]['dtstart'].dt
        end_dt = calendar.walk('VEVENT')[0]['dtend'].dt
>       assert start_dt == in_timezone(datetime(2022, 10, 21, 20, 0, 0), 'Europe/Stockholm')
E       AssertionError: assert datetime.datetime(2022, 10, 21, 20, 0, tzinfo=<StaticTzInfo 'Europe/Stockholm'>) == datetime.datetime(2022, 10, 21, 20, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/Stockholm'))
E        +  where datetime.datetime(2022, 10, 21, 20, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/Stockholm')) = <function <lambda> at 0x7f4c5699e950>(datetime.datetime(2022, 10, 21, 20, 0), 'Europe/Stockholm')
E        +    where datetime.datetime(2022, 10, 21, 20, 0) = datetime(2022, 10, 21, 20, 0, 0)

src/icalendar/tests/test_parsing.py:175: AssertionError
_ test_issue_156_period_list_in_rdate[issue_156_RDATE_with_PERIOD_TZID_khal_2-Europe/Berlin-0-20211101T160000/20211101T163000] _

calendars = {'_parser': <bound method Component.from_ical of <class 'icalendar.cal.Calendar'>>, '_data_source_folder': '/home/tklo...'artsprint 2012''), 'DESCRIPTION': vText('b'sprinting at the artsprint''), 'LOCATION': vText('b'aka bild\\, wien'')}))}
calname = 'issue_156_RDATE_with_PERIOD_TZID_khal_2', tzname = 'Europe/Berlin'
index = 0, period_string = '20211101T160000/20211101T163000'

    @pytest.mark.parametrize("calname,tzname,index,period_string", [
        ("issue_156_RDATE_with_PERIOD_TZID_khal_2", "Europe/Berlin", 0, "20211101T160000/20211101T163000"),
        ("issue_156_RDATE_with_PERIOD_TZID_khal_2", "Europe/Berlin", 1, "20211206T160000/20211206T163000"),
        ("issue_156_RDATE_with_PERIOD_TZID_khal_2", "Europe/Berlin", 2, "20220103T160000/20220103T163000"),
        ("issue_156_RDATE_with_PERIOD_TZID_khal_2", "Europe/Berlin", 3, "20220207T160000/20220207T163000"),
    ] + [
        ("issue_156_RDATE_with_PERIOD_TZID_khal", "America/Chicago", i, period)
        for i, period in enumerate(("20180327T080000/20180327T0"
            "90000,20180403T080000/20180403T090000,20180410T080000/20180410T090000,2018"
            "0417T080000/20180417T090000,20180424T080000/20180424T090000,20180501T08000"
            "0/20180501T090000,20180508T080000/20180508T090000,20180515T080000/20180515"
            "T090000,20180522T080000/20180522T090000,20180529T080000/20180529T090000,20"
            "180605T080000/20180605T090000,20180612T080000/20180612T090000,20180619T080"
            "000/20180619T090000,20180626T080000/20180626T090000,20180703T080000/201807"
            "03T090000,20180710T080000/20180710T090000,20180717T080000/20180717T090000,"
            "20180724T080000/20180724T090000,20180731T080000/20180731T090000").split(","))
    ])
    def test_issue_156_period_list_in_rdate(calendars, calname, tzname, index, period_string):
        """Check items in a list of period values."""
        calendar = calendars[calname]
        rdate = calendar.walk("vevent")[0]["rdate"]
        period = rdate.dts[index]
>       assert period.dt == vDDDTypes.from_ical(period_string, timezone=tzname)
E       AssertionError: assert (datetime.dat...1:00:00 STD>)) == (datetime.dat...ope/Berlin'>))
E
E         At index 0 diff: datetime.datetime(2021, 11, 1, 16, 0, tzinfo=<DstTzInfo 'Western/Central Europe' Western/Central Europe_19501029T020000_+0200_+0100+1:00:00 STD>) != datetime.datetime(2021, 11, 1, 16, 0, tzinfo=<StaticTzInfo 'Europe/Berlin'>)
E         Use -v to get more diff

src/icalendar/tests/test_period.py:35: AssertionError
_ test_issue_156_period_list_in_rdate[issue_156_RDATE_with_PERIOD_TZID_khal_2-Europe/Berlin-1-20211206T160000/20211206T163000] _

calendars = {'_parser': <bound method Component.from_ical of <class 'icalendar.cal.Calendar'>>, '_data_source_folder': '/home/tklo...'artsprint 2012''), 'DESCRIPTION': vText('b'sprinting at the artsprint''), 'LOCATION': vText('b'aka bild\\, wien'')}))}
calname = 'issue_156_RDATE_with_PERIOD_TZID_khal_2', tzname = 'Europe/Berlin'
index = 1, period_string = '20211206T160000/20211206T163000'

    @pytest.mark.parametrize("calname,tzname,index,period_string", [
        ("issue_156_RDATE_with_PERIOD_TZID_khal_2", "Europe/Berlin", 0, "20211101T160000/20211101T163000"),
        ("issue_156_RDATE_with_PERIOD_TZID_khal_2", "Europe/Berlin", 1, "20211206T160000/20211206T163000"),
        ("issue_156_RDATE_with_PERIOD_TZID_khal_2", "Europe/Berlin", 2, "20220103T160000/20220103T163000"),
        ("issue_156_RDATE_with_PERIOD_TZID_khal_2", "Europe/Berlin", 3, "20220207T160000/20220207T163000"),
    ] + [
        ("issue_156_RDATE_with_PERIOD_TZID_khal", "America/Chicago", i, period)
        for i, period in enumerate(("20180327T080000/20180327T0"
            "90000,20180403T080000/20180403T090000,20180410T080000/20180410T090000,2018"
            "0417T080000/20180417T090000,20180424T080000/20180424T090000,20180501T08000"
            "0/20180501T090000,20180508T080000/20180508T090000,20180515T080000/20180515"
            "T090000,20180522T080000/20180522T090000,20180529T080000/20180529T090000,20"
            "180605T080000/20180605T090000,20180612T080000/20180612T090000,20180619T080"
            "000/20180619T090000,20180626T080000/20180626T090000,20180703T080000/201807"
            "03T090000,20180710T080000/20180710T090000,20180717T080000/20180717T090000,"
            "20180724T080000/20180724T090000,20180731T080000/20180731T090000").split(","))
    ])
    def test_issue_156_period_list_in_rdate(calendars, calname, tzname, index, period_string):
        """Check items in a list of period values."""
        calendar = calendars[calname]
        rdate = calendar.walk("vevent")[0]["rdate"]
        period = rdate.dts[index]
>       assert period.dt == vDDDTypes.from_ical(period_string, timezone=tzname)
E       AssertionError: assert (datetime.dat...1:00:00 STD>)) == (datetime.dat...ope/Berlin'>))
E
E         At index 0 diff: datetime.datetime(2021, 12, 6, 16, 0, tzinfo=<DstTzInfo 'Western/Central Europe' Western/Central Europe_19501029T020000_+0200_+0100+1:00:00 STD>) != datetime.datetime(2021, 12, 6, 16, 0, tzinfo=<StaticTzInfo 'Europe/Berlin'>)
E         Use -v to get more diff

src/icalendar/tests/test_period.py:35: AssertionError
_ test_issue_156_period_list_in_rdate[issue_156_RDATE_with_PERIOD_TZID_khal_2-Europe/Berlin-2-20220103T160000/20220103T163000] _

calendars = {'_parser': <bound method Component.from_ical of <class 'icalendar.cal.Calendar'>>, '_data_source_folder': '/home/tklo...'artsprint 2012''), 'DESCRIPTION': vText('b'sprinting at the artsprint''), 'LOCATION': vText('b'aka bild\\, wien'')}))}
calname = 'issue_156_RDATE_with_PERIOD_TZID_khal_2', tzname = 'Europe/Berlin'
index = 2, period_string = '20220103T160000/20220103T163000'

    @pytest.mark.parametrize("calname,tzname,index,period_string", [
        ("issue_156_RDATE_with_PERIOD_TZID_khal_2", "Europe/Berlin", 0, "20211101T160000/20211101T163000"),
        ("issue_156_RDATE_with_PERIOD_TZID_khal_2", "Europe/Berlin", 1, "20211206T160000/20211206T163000"),
        ("issue_156_RDATE_with_PERIOD_TZID_khal_2", "Europe/Berlin", 2, "20220103T160000/20220103T163000"),
        ("issue_156_RDATE_with_PERIOD_TZID_khal_2", "Europe/Berlin", 3, "20220207T160000/20220207T163000"),
    ] + [
        ("issue_156_RDATE_with_PERIOD_TZID_khal", "America/Chicago", i, period)
        for i, period in enumerate(("20180327T080000/20180327T0"
            "90000,20180403T080000/20180403T090000,20180410T080000/20180410T090000,2018"
            "0417T080000/20180417T090000,20180424T080000/20180424T090000,20180501T08000"
            "0/20180501T090000,20180508T080000/20180508T090000,20180515T080000/20180515"
            "T090000,20180522T080000/20180522T090000,20180529T080000/20180529T090000,20"
            "180605T080000/20180605T090000,20180612T080000/20180612T090000,20180619T080"
            "000/20180619T090000,20180626T080000/20180626T090000,20180703T080000/201807"
            "03T090000,20180710T080000/20180710T090000,20180717T080000/20180717T090000,"
            "20180724T080000/20180724T090000,20180731T080000/20180731T090000").split(","))
    ])
    def test_issue_156_period_list_in_rdate(calendars, calname, tzname, index, period_string):
        """Check items in a list of period values."""
        calendar = calendars[calname]
        rdate = calendar.walk("vevent")[0]["rdate"]
        period = rdate.dts[index]
>       assert period.dt == vDDDTypes.from_ical(period_string, timezone=tzname)
E       AssertionError: assert (datetime.dat...1:00:00 STD>)) == (datetime.dat...ope/Berlin'>))
E
E         At index 0 diff: datetime.datetime(2022, 1, 3, 16, 0, tzinfo=<DstTzInfo 'Western/Central Europe' Western/Central Europe_19501029T020000_+0200_+0100+1:00:00 STD>) != datetime.datetime(2022, 1, 3, 16, 0, tzinfo=<StaticTzInfo 'Europe/Berlin'>)
E         Use -v to get more diff

src/icalendar/tests/test_period.py:35: AssertionError
_ test_issue_156_period_list_in_rdate[issue_156_RDATE_with_PERIOD_TZID_khal_2-Europe/Berlin-3-20220207T160000/20220207T163000] _

calendars = {'_parser': <bound method Component.from_ical of <class 'icalendar.cal.Calendar'>>, '_data_source_folder': '/home/tklo...'artsprint 2012''), 'DESCRIPTION': vText('b'sprinting at the artsprint''), 'LOCATION': vText('b'aka bild\\, wien'')}))}
calname = 'issue_156_RDATE_with_PERIOD_TZID_khal_2', tzname = 'Europe/Berlin'
index = 3, period_string = '20220207T160000/20220207T163000'

    @pytest.mark.parametrize("calname,tzname,index,period_string", [
        ("issue_156_RDATE_with_PERIOD_TZID_khal_2", "Europe/Berlin", 0, "20211101T160000/20211101T163000"),
        ("issue_156_RDATE_with_PERIOD_TZID_khal_2", "Europe/Berlin", 1, "20211206T160000/20211206T163000"),
        ("issue_156_RDATE_with_PERIOD_TZID_khal_2", "Europe/Berlin", 2, "20220103T160000/20220103T163000"),
        ("issue_156_RDATE_with_PERIOD_TZID_khal_2", "Europe/Berlin", 3, "20220207T160000/20220207T163000"),
    ] + [
        ("issue_156_RDATE_with_PERIOD_TZID_khal", "America/Chicago", i, period)
        for i, period in enumerate(("20180327T080000/20180327T0"
            "90000,20180403T080000/20180403T090000,20180410T080000/20180410T090000,2018"
            "0417T080000/20180417T090000,20180424T080000/20180424T090000,20180501T08000"
            "0/20180501T090000,20180508T080000/20180508T090000,20180515T080000/20180515"
            "T090000,20180522T080000/20180522T090000,20180529T080000/20180529T090000,20"
            "180605T080000/20180605T090000,20180612T080000/20180612T090000,20180619T080"
            "000/20180619T090000,20180626T080000/20180626T090000,20180703T080000/201807"
            "03T090000,20180710T080000/20180710T090000,20180717T080000/20180717T090000,"
            "20180724T080000/20180724T090000,20180731T080000/20180731T090000").split(","))
    ])
    def test_issue_156_period_list_in_rdate(calendars, calname, tzname, index, period_string):
        """Check items in a list of period values."""
        calendar = calendars[calname]
        rdate = calendar.walk("vevent")[0]["rdate"]
        period = rdate.dts[index]
>       assert period.dt == vDDDTypes.from_ical(period_string, timezone=tzname)
E       AssertionError: assert (datetime.dat...1:00:00 STD>)) == (datetime.dat...ope/Berlin'>))
E
E         At index 0 diff: datetime.datetime(2022, 2, 7, 16, 0, tzinfo=<DstTzInfo 'Western/Central Europe' Western/Central Europe_19501029T020000_+0200_+0100+1:00:00 STD>) != datetime.datetime(2022, 2, 7, 16, 0, tzinfo=<StaticTzInfo 'Europe/Berlin'>)
E         Use -v to get more diff

src/icalendar/tests/test_period.py:35: AssertionError
_ test_list_exdate_to_ical_is_inverse_of_from_ical[<lambda>2-0-exception_date0-20120529T100000] _

events = {'_parser': <bound method Component.from_ical of <class 'icalendar.cal.Event'>>, '_data_source_folder': '/home/tkloczk...007-02-21 09:54:12+00:00, Parameters({})), 'SEQUENCE': 0}), 'issue_82_expected_output': VEVENT({'ATTACH': 'dGV4dA=='})}
i = 0, exception_date = datetime.datetime(2012, 5, 29, 10, 0)
exception_date_ics = b'20120529T100000'
in_timezone = <function <lambda> at 0x7f4c5699e950>

    @pytest.mark.parametrize('i, exception_date, exception_date_ics', [
        (0, datetime(2012, 5, 29, 10, 0), b'20120529T100000'),
        (1, datetime(2012, 4, 3, 10, 0),  b'20120403T100000'),
        (2, datetime(2012, 4, 10, 10, 0), b'20120410T100000'),
        (3, datetime(2012, 5, 1, 10, 0),  b'20120501T100000'),
        (4, datetime(2012, 4, 17, 10, 0), b'20120417T100000')
    ])
    def test_list_exdate_to_ical_is_inverse_of_from_ical(events, i, exception_date, exception_date_ics, in_timezone):
        exdate = events.event_with_recurrence_exdates_on_different_lines['exdate']
>       assert exdate[i].dts[0].dt == in_timezone(exception_date, 'Europe/Vienna')
E       AssertionError: assert datetime.datetime(2012, 5, 29, 10, 0, tzinfo=<StaticTzInfo 'Europe/Vienna'>) == datetime.datetime(2012, 5, 29, 10, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/Vienna'))
E        +  where datetime.datetime(2012, 5, 29, 10, 0, tzinfo=<StaticTzInfo 'Europe/Vienna'>) = vDDDTypes(2012-05-29 10:00:00+00:00, Parameters({'TZID': 'Europe/Vienna'})).dt
E        +  and   datetime.datetime(2012, 5, 29, 10, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/Vienna')) = <function <lambda> at 0x7f4c5699e950>(datetime.datetime(2012, 5, 29, 10, 0), 'Europe/Vienna')

src/icalendar/tests/test_recurrence.py:41: AssertionError
_ test_list_exdate_to_ical_is_inverse_of_from_ical[<lambda>2-1-exception_date1-20120403T100000] _

events = {'_parser': <bound method Component.from_ical of <class 'icalendar.cal.Event'>>, '_data_source_folder': '/home/tkloczk...007-02-21 09:54:12+00:00, Parameters({})), 'SEQUENCE': 0}), 'issue_82_expected_output': VEVENT({'ATTACH': 'dGV4dA=='})}
i = 1, exception_date = datetime.datetime(2012, 4, 3, 10, 0)
exception_date_ics = b'20120403T100000'
in_timezone = <function <lambda> at 0x7f4c5699e950>

    @pytest.mark.parametrize('i, exception_date, exception_date_ics', [
        (0, datetime(2012, 5, 29, 10, 0), b'20120529T100000'),
        (1, datetime(2012, 4, 3, 10, 0),  b'20120403T100000'),
        (2, datetime(2012, 4, 10, 10, 0), b'20120410T100000'),
        (3, datetime(2012, 5, 1, 10, 0),  b'20120501T100000'),
        (4, datetime(2012, 4, 17, 10, 0), b'20120417T100000')
    ])
    def test_list_exdate_to_ical_is_inverse_of_from_ical(events, i, exception_date, exception_date_ics, in_timezone):
        exdate = events.event_with_recurrence_exdates_on_different_lines['exdate']
>       assert exdate[i].dts[0].dt == in_timezone(exception_date, 'Europe/Vienna')
E       AssertionError: assert datetime.datetime(2012, 4, 3, 10, 0, tzinfo=<StaticTzInfo 'Europe/Vienna'>) == datetime.datetime(2012, 4, 3, 10, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/Vienna'))
E        +  where datetime.datetime(2012, 4, 3, 10, 0, tzinfo=<StaticTzInfo 'Europe/Vienna'>) = vDDDTypes(2012-04-03 10:00:00+00:00, Parameters({'TZID': 'Europe/Vienna'})).dt
E        +  and   datetime.datetime(2012, 4, 3, 10, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/Vienna')) = <function <lambda> at 0x7f4c5699e950>(datetime.datetime(2012, 4, 3, 10, 0), 'Europe/Vienna')

src/icalendar/tests/test_recurrence.py:41: AssertionError
_ test_list_exdate_to_ical_is_inverse_of_from_ical[<lambda>2-2-exception_date2-20120410T100000] _

events = {'_parser': <bound method Component.from_ical of <class 'icalendar.cal.Event'>>, '_data_source_folder': '/home/tkloczk...007-02-21 09:54:12+00:00, Parameters({})), 'SEQUENCE': 0}), 'issue_82_expected_output': VEVENT({'ATTACH': 'dGV4dA=='})}
i = 2, exception_date = datetime.datetime(2012, 4, 10, 10, 0)
exception_date_ics = b'20120410T100000'
in_timezone = <function <lambda> at 0x7f4c5699e950>

    @pytest.mark.parametrize('i, exception_date, exception_date_ics', [
        (0, datetime(2012, 5, 29, 10, 0), b'20120529T100000'),
        (1, datetime(2012, 4, 3, 10, 0),  b'20120403T100000'),
        (2, datetime(2012, 4, 10, 10, 0), b'20120410T100000'),
        (3, datetime(2012, 5, 1, 10, 0),  b'20120501T100000'),
        (4, datetime(2012, 4, 17, 10, 0), b'20120417T100000')
    ])
    def test_list_exdate_to_ical_is_inverse_of_from_ical(events, i, exception_date, exception_date_ics, in_timezone):
        exdate = events.event_with_recurrence_exdates_on_different_lines['exdate']
>       assert exdate[i].dts[0].dt == in_timezone(exception_date, 'Europe/Vienna')
E       AssertionError: assert datetime.datetime(2012, 4, 10, 10, 0, tzinfo=<StaticTzInfo 'Europe/Vienna'>) == datetime.datetime(2012, 4, 10, 10, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/Vienna'))
E        +  where datetime.datetime(2012, 4, 10, 10, 0, tzinfo=<StaticTzInfo 'Europe/Vienna'>) = vDDDTypes(2012-04-10 10:00:00+00:00, Parameters({'TZID': 'Europe/Vienna'})).dt
E        +  and   datetime.datetime(2012, 4, 10, 10, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/Vienna')) = <function <lambda> at 0x7f4c5699e950>(datetime.datetime(2012, 4, 10, 10, 0), 'Europe/Vienna')

src/icalendar/tests/test_recurrence.py:41: AssertionError
_ test_list_exdate_to_ical_is_inverse_of_from_ical[<lambda>2-3-exception_date3-20120501T100000] _

events = {'_parser': <bound method Component.from_ical of <class 'icalendar.cal.Event'>>, '_data_source_folder': '/home/tkloczk...007-02-21 09:54:12+00:00, Parameters({})), 'SEQUENCE': 0}), 'issue_82_expected_output': VEVENT({'ATTACH': 'dGV4dA=='})}
i = 3, exception_date = datetime.datetime(2012, 5, 1, 10, 0)
exception_date_ics = b'20120501T100000'
in_timezone = <function <lambda> at 0x7f4c5699e950>

    @pytest.mark.parametrize('i, exception_date, exception_date_ics', [
        (0, datetime(2012, 5, 29, 10, 0), b'20120529T100000'),
        (1, datetime(2012, 4, 3, 10, 0),  b'20120403T100000'),
        (2, datetime(2012, 4, 10, 10, 0), b'20120410T100000'),
        (3, datetime(2012, 5, 1, 10, 0),  b'20120501T100000'),
        (4, datetime(2012, 4, 17, 10, 0), b'20120417T100000')
    ])
    def test_list_exdate_to_ical_is_inverse_of_from_ical(events, i, exception_date, exception_date_ics, in_timezone):
        exdate = events.event_with_recurrence_exdates_on_different_lines['exdate']
>       assert exdate[i].dts[0].dt == in_timezone(exception_date, 'Europe/Vienna')
E       AssertionError: assert datetime.datetime(2012, 5, 1, 10, 0, tzinfo=<StaticTzInfo 'Europe/Vienna'>) == datetime.datetime(2012, 5, 1, 10, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/Vienna'))
E        +  where datetime.datetime(2012, 5, 1, 10, 0, tzinfo=<StaticTzInfo 'Europe/Vienna'>) = vDDDTypes(2012-05-01 10:00:00+00:00, Parameters({'TZID': 'Europe/Vienna'})).dt
E        +  and   datetime.datetime(2012, 5, 1, 10, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/Vienna')) = <function <lambda> at 0x7f4c5699e950>(datetime.datetime(2012, 5, 1, 10, 0), 'Europe/Vienna')

src/icalendar/tests/test_recurrence.py:41: AssertionError
_ test_list_exdate_to_ical_is_inverse_of_from_ical[<lambda>2-4-exception_date4-20120417T100000] _

events = {'_parser': <bound method Component.from_ical of <class 'icalendar.cal.Event'>>, '_data_source_folder': '/home/tkloczk...007-02-21 09:54:12+00:00, Parameters({})), 'SEQUENCE': 0}), 'issue_82_expected_output': VEVENT({'ATTACH': 'dGV4dA=='})}
i = 4, exception_date = datetime.datetime(2012, 4, 17, 10, 0)
exception_date_ics = b'20120417T100000'
in_timezone = <function <lambda> at 0x7f4c5699e950>

    @pytest.mark.parametrize('i, exception_date, exception_date_ics', [
        (0, datetime(2012, 5, 29, 10, 0), b'20120529T100000'),
        (1, datetime(2012, 4, 3, 10, 0),  b'20120403T100000'),
        (2, datetime(2012, 4, 10, 10, 0), b'20120410T100000'),
        (3, datetime(2012, 5, 1, 10, 0),  b'20120501T100000'),
        (4, datetime(2012, 4, 17, 10, 0), b'20120417T100000')
    ])
    def test_list_exdate_to_ical_is_inverse_of_from_ical(events, i, exception_date, exception_date_ics, in_timezone):
        exdate = events.event_with_recurrence_exdates_on_different_lines['exdate']
>       assert exdate[i].dts[0].dt == in_timezone(exception_date, 'Europe/Vienna')
E       AssertionError: assert datetime.datetime(2012, 4, 17, 10, 0, tzinfo=<StaticTzInfo 'Europe/Vienna'>) == datetime.datetime(2012, 4, 17, 10, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/Vienna'))
E        +  where datetime.datetime(2012, 4, 17, 10, 0, tzinfo=<StaticTzInfo 'Europe/Vienna'>) = vDDDTypes(2012-04-17 10:00:00+00:00, Parameters({'TZID': 'Europe/Vienna'})).dt
E        +  and   datetime.datetime(2012, 4, 17, 10, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/Vienna')) = <function <lambda> at 0x7f4c5699e950>(datetime.datetime(2012, 4, 17, 10, 0), 'Europe/Vienna')

src/icalendar/tests/test_recurrence.py:41: AssertionError
_________________ TestTimezoned.test_create_from_ical_zoneinfo _________________

self = <icalendar.tests.test_timezoned.TestTimezoned testMethod=test_create_from_ical_zoneinfo>

    def test_create_from_ical_zoneinfo(self):
        with open(os.path.join(CALENDARS_DIRECTORY, 'timezoned.ics'), 'rb') as fp:
            data = fp.read()
        cal = icalendar.Calendar.from_ical(data)

        self.assertEqual(
            cal['prodid'].to_ical(),
            b"-//Plone.org//NONSGML plone.app.event//EN"
        )

        timezones = cal.walk('VTIMEZONE')
        self.assertEqual(len(timezones), 1)

        tz = timezones[0]
        self.assertEqual(tz['tzid'].to_ical(), b"Europe/Vienna")

        std = tz.walk('STANDARD')[0]
        self.assertEqual(
            std.decoded('TZOFFSETFROM'),
            datetime.timedelta(0, 7200)
        )

        ev1 = cal.walk('VEVENT')[0]
>       self.assertEqual(
            ev1.decoded('DTSTART'),
            datetime.datetime(2012, 2, 13, 10, 0, 0, tzinfo=zoneinfo.ZoneInfo('Europe/Vienna'))
        )
E       AssertionError: datet[16 chars]2, 2, 13, 10, 0, tzinfo=<StaticTzInfo 'Europe/Vienna'>) != datet[16 chars]2, 2, 13, 10, 0, tzinfo=zoneinfo.ZoneInfo(key='Europe/Vienna'))

src/icalendar/tests/test_timezoned.py:41: AssertionError
____________________ TestTimezoned.test_create_to_ical_pytz ____________________

self = <icalendar.tests.test_timezoned.TestTimezoned testMethod=test_create_to_ical_pytz>

    def test_create_to_ical_pytz(self):
        cal = icalendar.Calendar()

        cal.add('prodid', "-//Plone.org//NONSGML plone.app.event//EN")
        cal.add('version', "2.0")
        cal.add('x-wr-calname', "test create calendar")
        cal.add('x-wr-caldesc', "icalendar tests")
        cal.add('x-wr-relcalid', "12345")
        cal.add('x-wr-timezone', "Europe/Vienna")

        tzc = icalendar.Timezone()
        tzc.add('tzid', 'Europe/Vienna')
        tzc.add('x-lic-location', 'Europe/Vienna')

        tzs = icalendar.TimezoneStandard()
        tzs.add('tzname', 'CET')
        tzs.add('dtstart', datetime.datetime(1970, 10, 25, 3, 0, 0))
        tzs.add('rrule', {'freq': 'yearly', 'bymonth': 10, 'byday': '-1su'})
        tzs.add('TZOFFSETFROM', datetime.timedelta(hours=2))
        tzs.add('TZOFFSETTO', datetime.timedelta(hours=1))

        tzd = icalendar.TimezoneDaylight()
        tzd.add('tzname', 'CEST')
        tzd.add('dtstart', datetime.datetime(1970, 3, 29, 2, 0, 0))
        tzs.add('rrule', {'freq': 'yearly', 'bymonth': 3, 'byday': '-1su'})
        tzd.add('TZOFFSETFROM', datetime.timedelta(hours=1))
        tzd.add('TZOFFSETTO', datetime.timedelta(hours=2))

        tzc.add_component(tzs)
        tzc.add_component(tzd)
        cal.add_component(tzc)

        event = icalendar.Event()
        tz = pytz.timezone("Europe/Vienna")
        event.add(
            'dtstart',
            tz.localize(datetime.datetime(2012, 2, 13, 10, 00, 00)))
        event.add(
            'dtend',
            tz.localize(datetime.datetime(2012, 2, 17, 18, 00, 00)))
        event.add(
            'dtstamp',
            tz.localize(datetime.datetime(2010, 10, 10, 10, 10, 10)))
        event.add(
            'created',
            tz.localize(datetime.datetime(2010, 10, 10, 10, 10, 10)))
        event.add('uid', '123456')
        event.add(
            'last-modified',
            tz.localize(datetime.datetime(2010, 10, 10, 10, 10, 10)))
        event.add('summary', 'artsprint 2012')
        # event.add('rrule', 'FREQ=YEARLY;INTERVAL=1;COUNT=10')
        event.add('description', 'sprinting at the artsprint')
        event.add('location', 'aka bild, wien')
        event.add('categories', 'first subject')
        event.add('categories', 'second subject')
        event.add('attendee', 'häns')
        event.add('attendee', 'franz')
        event.add('attendee', 'sepp')
        event.add('contact', 'Max Mustermann, 1010 Wien')
        event.add('url', 'https://plone.org')
        cal.add_component(event)

        test_out = b'|'.join(cal.to_ical().splitlines())
        test_out = test_out.decode('utf-8')

        vtimezone_lines = "BEGIN:VTIMEZONE|TZID:Europe/Vienna|X-LIC-LOCATION:"
        "Europe/Vienna|BEGIN:STANDARD|DTSTART:19701025T03"
        "0000|RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10|RRULE:FREQ=YEARLY;B"
        "YDAY=-1SU;BYMONTH=3|TZNAME:CET|TZOFFSETFROM:+0200|TZOFFSETTO:+01"
        "00|END:STANDARD|BEGIN:DAYLIGHT|DTSTART:19700329T"
        "020000|TZNAME:CEST|TZOFFSETFROM:+0100|TZOFFSETTO:+0200|END:DAYLI"
        "GHT|END:VTIMEZONE"
        self.assertTrue(vtimezone_lines in test_out)

        test_str = "DTSTART;TZID=Europe/Vienna:20120213T100000"
        self.assertTrue(test_str in test_out)
        self.assertTrue("ATTENDEE:sepp" in test_out)

        # ical standard expects DTSTAMP and CREATED in UTC
>       self.assertTrue("DTSTAMP:20101010T081010Z" in test_out)
E       AssertionError: False is not true

src/icalendar/tests/test_timezoned.py:166: AssertionError
______________ TestTimezoneCreation.test_create_america_new_york _______________

self = <icalendar.tests.test_timezoned.TestTimezoneCreation testMethod=test_create_america_new_york>

    def test_create_america_new_york(self):
        """testing America/New_York, the most complex example from the
        RFC"""
        with open(os.path.join(CALENDARS_DIRECTORY, 'america_new_york.ics'), 'rb') as fp:
            data = fp.read()
        cal = icalendar.Calendar.from_ical(data)

        tz = cal.walk('VEVENT')[0]['DTSTART'][0].dt.tzinfo
        self.assertEqual(str(tz), 'custom_America/New_York')
        pytz_new_york = pytz.timezone('America/New_York')
        # for reasons (tm) the locally installed version of the time zone
        # database isn't always complete, therefore we only compare some
        # transition times
        ny_transition_times = []
        ny_transition_info = []
>       for num, date in enumerate(pytz_new_york._utc_transition_times):
E       AttributeError: 'America/New_York' object has no attribute '_utc_transition_times'

src/icalendar/tests/test_timezoned.py:285: AttributeError
____________________________ test_cal_Component_add ____________________________

comp = Component({'DTSTART': vDDDTypes(2010-10-10 10:00:00+00:00, Parameters({'TZID': 'Europe/Vienna'})), 'CREATED': vDDDType...pes(2010-10-10 14:00:00+00:00, Parameters({})), 'LAST-MODIFIED': vDDDTypes(2010-10-10 16:00:00+00:00, Parameters({}))})

    def test_cal_Component_add(comp):
        """Test the for timezone correctness: dtstart should preserve it's
        timezone, created, dtstamp and last-modified must be in UTC.
        """
        vienna = pytz.timezone("Europe/Vienna")
        comp.add('dtstart', vienna.localize(datetime(2010, 10, 10, 10, 0, 0)))
        comp.add('created', datetime(2010, 10, 10, 12, 0, 0))
        comp.add('dtstamp', vienna.localize(datetime(2010, 10, 10, 14, 0, 0)))
        comp.add('last-modified', pytz.utc.localize(
            datetime(2010, 10, 10, 16, 0, 0)))

        lines = comp.to_ical().splitlines()
        assert b"DTSTART;TZID=Europe/Vienna:20101010T100000" in lines
        assert b"CREATED:20101010T120000Z" in lines
>       assert b"DTSTAMP:20101010T120000Z" in lines
E       AssertionError: assert b'DTSTAMP:20101010T120000Z' in [b'BEGIN:None', b'CREATED:20101010T120000Z', b'DTSTAMP:20101010T140000Z', b'DTSTART;TZID=Europe/Vienna:20101010T100000', b'LAST-MODIFIED:20101010T160000Z', b'END:None']

src/icalendar/tests/test_unit_cal.py:216: AssertionError
_________________________ TestProp.test_prop_vDatetime _________________________

self = <icalendar.tests.test_unit_prop.TestProp testMethod=test_prop_vDatetime>

    def test_prop_vDatetime(self):
        from ..prop import vDatetime

        dt = datetime(2001, 1, 1, 12, 30, 0)
        self.assertEqual(vDatetime(dt).to_ical(), b'20010101T123000')

        self.assertEqual(vDatetime.from_ical('20000101T120000'),
                         datetime(2000, 1, 1, 12, 0))

        dutc = pytz.utc.localize(datetime(2001, 1, 1, 12, 30, 0))
        self.assertEqual(vDatetime(dutc).to_ical(), b'20010101T123000Z')

        dutc = pytz.utc.localize(datetime(1899, 1, 1, 12, 30, 0))
        self.assertEqual(vDatetime(dutc).to_ical(), b'18990101T123000Z')

        self.assertEqual(vDatetime.from_ical('20010101T000000'),
                         datetime(2001, 1, 1, 0, 0))

        self.assertRaises(ValueError, vDatetime.from_ical, '20010101T000000A')

        utc = vDatetime.from_ical('20010101T000000Z')
        self.assertEqual(vDatetime(utc).to_ical(), b'20010101T000000Z')

        # 1 minute before transition to DST
        dat = vDatetime.from_ical('20120311T015959', 'America/Denver')
>       self.assertEqual(dat.strftime('%Y%m%d%H%M%S %z'),
                         '20120311015959 -0700')
E       AssertionError: '20120311015959 +0000' != '20120311015959 -0700'
E       - 20120311015959 +0000
E       ?                ^ ^
E       + 20120311015959 -0700
E       ?                ^ ^

src/icalendar/tests/test_unit_prop.py:152: AssertionError
_______________ test_vDDDTypes_equivalance[other0-v_type2-hash] ________________

map = <built-in function hash>
v_type = vDDDTypes(2022-07-22 12:07:00+00:00, Parameters({}))
other = vDDDTypes(2022-07-22 12:07:00+00:00, Parameters({'TZID': 'EST'}))

    @pytest.mark.parametrize("map", [
        deepcopy,
        identity,
        hash,
    ])
    @pytest.mark.parametrize("v_type", vDDDTypes_list)
    @pytest.mark.parametrize("other", vDDDTypes_list)
    def test_vDDDTypes_equivalance(map, v_type, other):
        if v_type is other:
            assert map(v_type) == map(other), f"identity implies equality: {map.__name__}()"
            assert not (map(v_type) != map(other)), f"identity implies equality: {map.__name__}()"
        else:
>           assert map(v_type) != map(other), f"expected inequality: {map.__name__}()"
E           AssertionError: expected inequality: hash()
E           assert 254678468779534770 != 254678468779534770
E            +  where 254678468779534770 = <built-in function hash>(vDDDTypes(2022-07-22 12:07:00+00:00, Parameters({})))
E            +  and   254678468779534770 = <built-in function hash>(vDDDTypes(2022-07-22 12:07:00+00:00, Parameters({'TZID': 'EST'})))

src/icalendar/tests/test_unit_prop.py:539: AssertionError
_______________ test_vDDDTypes_equivalance[other2-v_type0-hash] ________________

map = <built-in function hash>
v_type = vDDDTypes(2022-07-22 12:07:00+00:00, Parameters({'TZID': 'EST'}))
other = vDDDTypes(2022-07-22 12:07:00+00:00, Parameters({}))

    @pytest.mark.parametrize("map", [
        deepcopy,
        identity,
        hash,
    ])
    @pytest.mark.parametrize("v_type", vDDDTypes_list)
    @pytest.mark.parametrize("other", vDDDTypes_list)
    def test_vDDDTypes_equivalance(map, v_type, other):
        if v_type is other:
            assert map(v_type) == map(other), f"identity implies equality: {map.__name__}()"
            assert not (map(v_type) != map(other)), f"identity implies equality: {map.__name__}()"
        else:
>           assert map(v_type) != map(other), f"expected inequality: {map.__name__}()"
E           AssertionError: expected inequality: hash()
E           assert 254678468779534770 != 254678468779534770
E            +  where 254678468779534770 = <built-in function hash>(vDDDTypes(2022-07-22 12:07:00+00:00, Parameters({'TZID': 'EST'})))
E            +  and   254678468779534770 = <built-in function hash>(vDDDTypes(2022-07-22 12:07:00+00:00, Parameters({})))

src/icalendar/tests/test_unit_prop.py:539: AssertionError
=========================== short test summary info ============================
SKIPPED [1] src/icalendar/tests/fuzzed/test_fuzzed_calendars.py: got empty parameter set ['fuzz_v1_calendar'], function test_fuzz_v1 at /home/tkloczko/rpmbuild/BUILD/icalendar-5.0.12/src/icalendar/tests/fuzzed/test_fuzzed_calendars.py:4
FAILED src/icalendar/tests/test_cli_tool.py::CLIToolTest::test_output_is_proper
FAILED src/icalendar/tests/test_encoding.py::test_parses_event_with_non_ascii_tzid_issue_237[<lambda>0]
FAILED src/icalendar/tests/test_encoding.py::test_parses_event_with_non_ascii_tzid_issue_237[<lambda>1]
FAILED src/icalendar/tests/test_examples.py::test_creating_calendar_with_unicode_fields[utc4]
FAILED src/icalendar/tests/test_parsing.py::test_timezone_name_parsed_issue_112
FAILED src/icalendar/tests/test_parsing.py::test_no_tzid_when_utc[utc4-date0-DTSTART:20120716T000000Z]
FAILED src/icalendar/tests/test_parsing.py::test_no_tzid_when_utc[utc4-date1-DTSTART:20211117T150915Z]
FAILED src/icalendar/tests/test_parsing.py::test_handles_unique_tzid[<lambda>0-issue_466_respect_unique_timezone]
FAILED src/icalendar/tests/test_parsing.py::test_handles_unique_tzid[<lambda>1-issue_466_respect_unique_timezone]
FAILED src/icalendar/tests/test_parsing.py::test_handles_unique_tzid[<lambda>2-issue_466_convert_tzid_with_slash]
FAILED src/icalendar/tests/test_period.py::test_issue_156_period_list_in_rdate[issue_156_RDATE_with_PERIOD_TZID_khal_2-Europe/Berlin-0-20211101T160000/20211101T163000]
FAILED src/icalendar/tests/test_period.py::test_issue_156_period_list_in_rdate[issue_156_RDATE_with_PERIOD_TZID_khal_2-Europe/Berlin-1-20211206T160000/20211206T163000]
FAILED src/icalendar/tests/test_period.py::test_issue_156_period_list_in_rdate[issue_156_RDATE_with_PERIOD_TZID_khal_2-Europe/Berlin-2-20220103T160000/20220103T163000]
FAILED src/icalendar/tests/test_period.py::test_issue_156_period_list_in_rdate[issue_156_RDATE_with_PERIOD_TZID_khal_2-Europe/Berlin-3-20220207T160000/20220207T163000]
FAILED src/icalendar/tests/test_recurrence.py::test_list_exdate_to_ical_is_inverse_of_from_ical[<lambda>2-0-exception_date0-20120529T100000]
FAILED src/icalendar/tests/test_recurrence.py::test_list_exdate_to_ical_is_inverse_of_from_ical[<lambda>2-1-exception_date1-20120403T100000]
FAILED src/icalendar/tests/test_recurrence.py::test_list_exdate_to_ical_is_inverse_of_from_ical[<lambda>2-2-exception_date2-20120410T100000]
FAILED src/icalendar/tests/test_recurrence.py::test_list_exdate_to_ical_is_inverse_of_from_ical[<lambda>2-3-exception_date3-20120501T100000]
FAILED src/icalendar/tests/test_recurrence.py::test_list_exdate_to_ical_is_inverse_of_from_ical[<lambda>2-4-exception_date4-20120417T100000]
FAILED src/icalendar/tests/test_timezoned.py::TestTimezoned::test_create_from_ical_zoneinfo
FAILED src/icalendar/tests/test_timezoned.py::TestTimezoned::test_create_to_ical_pytz
FAILED src/icalendar/tests/test_timezoned.py::TestTimezoneCreation::test_create_america_new_york
FAILED src/icalendar/tests/test_unit_cal.py::test_cal_Component_add - Asserti...
FAILED src/icalendar/tests/test_unit_prop.py::TestProp::test_prop_vDatetime
FAILED src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other0-v_type2-hash]
FAILED src/icalendar/tests/test_unit_prop.py::test_vDDDTypes_equivalance[other2-v_type0-hash]
================== 26 failed, 845 passed, 1 skipped in 3.09s ===================
List of installed modules in build env:
Package                       Version
----------------------------- -----------
alabaster                     0.7.16
attrs                         23.2.0
Babel                         2.15.0
build                         1.2.1
charset-normalizer            3.3.2
defusedxml                    0.7.1
docutils                      0.20.1
exceptiongroup                1.1.3
hypothesis                    6.100.0
idna                          3.7
imagesize                     1.4.1
importlib_metadata            7.1.0
iniconfig                     2.0.0
installer                     0.7.0
Jinja2                        3.1.4
MarkupSafe                    2.1.5
packaging                     24.0
pluggy                        1.5.0
Pygments                      2.18.0
pyproject_hooks               1.0.0
pytest                        8.2.1
python-dateutil               2.9.0.post0
pytz                          2024.1
requests                      2.32.2
setuptools                    69.4.0
snowballstemmer               2.2.0
sortedcontainers              2.4.0
Sphinx                        7.3.7
sphinxcontrib-applehelp       1.0.8
sphinxcontrib-devhelp         1.0.6
sphinxcontrib-htmlhelp        2.0.5
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.7
sphinxcontrib-serializinghtml 1.1.10
tokenize_rt                   5.2.0
tomli                         2.0.1
urllib3                       2.2.1
wheel                         0.43.0
zipp                          3.19.0

Please let me know if you need more details or want me to perform some diagnostics.

@niccokunzmann
Copy link
Member

Thanks for reporting this! You provided a lot of detail on how to reproduce it. That's good!

This is interesting:

>       for num, date in enumerate(pytz_new_york._utc_transition_times):
E       AttributeError: 'America/New_York' object has no attribute '_utc_transition_times'
  • There seems to be something about the timezone implementation maybe not being pytz. I will check the master branch of icalendar .... No, all tests run.
  • Which version do you package/run the tests on? python-icalendar-5.0.12-2.fc37.x86_64, Python 3.10.14

I am unable to reproduce this in the master and the v5.0.12 tag. I used the same Python version and the same environment.

I never packaged a module. So, could you help me understand what the commands for the last three steps are?

  • install .whl file in </install/prefix> using installer module
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")

@kloczek
Copy link
Contributor Author

kloczek commented Jun 3, 2024

If it is something related to pytz it should be replaced by zoneinfo like in pydantic/pydantic-core@fd262933

@kloczek
Copy link
Contributor Author

kloczek commented Jun 3, 2024

Just found that this has been already reported #609

@kloczek
Copy link
Contributor Author

kloczek commented Jun 20, 2024

Just tested 5.0.13 and looks like all is good now

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-icalendar-5.0.13-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-icalendar-5.0.13-2.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network' src/icalendar/tests
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.10.14, pytest-8.2.2, pluggy-1.5.0
rootdir: /home/tkloczko/rpmbuild/BUILD/icalendar-5.0.13
configfile: setup.cfg
plugins: hypothesis-6.100.0
collected 884 items

src/icalendar/tests/fuzzed/test_fuzzed_calendars.py s                                                                                                                                 [  0%]
src/icalendar/tests/test_cli_tool.py .                                                                                                                                                [  0%]
src/icalendar/tests/test_components_break_on_bad_ics.py .......                                                                                                                       [  1%]
src/icalendar/tests/test_encoding.py .................                                                                                                                                [  2%]
src/icalendar/tests/test_equality.py ................................................................................................................................................ [ 19%]
..................................................................................................................................................................................... [ 39%]
...............................................                                                                                                                                       [ 45%]
src/icalendar/tests/test_examples.py .....                                                                                                                                            [ 45%]
src/icalendar/tests/test_icalendar.py .......                                                                                                                                         [ 46%]
src/icalendar/tests/test_issue_116.py .                                                                                                                                               [ 46%]
src/icalendar/tests/test_issue_165_missing_event.py .                                                                                                                                 [ 46%]
src/icalendar/tests/test_issue_168_parsing_invalid_calendars_no_warning.py .                                                                                                          [ 46%]
src/icalendar/tests/test_issue_27_period.py .                                                                                                                                         [ 46%]
src/icalendar/tests/test_issue_318_skip_default_parameters.py ...                                                                                                                     [ 47%]
src/icalendar/tests/test_issue_322_single_strings_characters_split_into_multiple_categories.py .                                                                                      [ 47%]
src/icalendar/tests/test_issue_348_exception_parsing_value.py ..                                                                                                                      [ 47%]
src/icalendar/tests/test_issue_350.py .                                                                                                                                               [ 47%]
src/icalendar/tests/test_issue_500_vboolean_for_parameter.py .                                                                                                                        [ 47%]
src/icalendar/tests/test_issue_557_encode_native_parameters.py ........                                                                                                               [ 48%]
src/icalendar/tests/test_multiple.py .                                                                                                                                                [ 48%]
src/icalendar/tests/test_oss_fuzz_errors.py ..                                                                                                                                        [ 48%]
src/icalendar/tests/test_parsing.py .............................................                                                                                                     [ 54%]
src/icalendar/tests/test_period.py ..........................                                                                                                                         [ 57%]
src/icalendar/tests/test_property_params.py ....................                                                                                                                      [ 59%]
src/icalendar/tests/test_recurrence.py ....................................                                                                                                           [ 63%]
src/icalendar/tests/test_time.py ....                                                                                                                                                 [ 63%]
src/icalendar/tests/test_timezoned.py ..........                                                                                                                                      [ 64%]
src/icalendar/tests/test_unit_cal.py ............................................................................................                                                     [ 75%]
src/icalendar/tests/test_unit_caselessdict.py ....                                                                                                                                    [ 75%]
src/icalendar/tests/test_unit_parser_tools.py ..                                                                                                                                      [ 76%]
src/icalendar/tests/test_unit_prop.py ...........................................................................................................................................     [ 91%]
src/icalendar/tests/test_unit_tools.py ..........                                                                                                                                     [ 92%]
src/icalendar/tests/test_with_doctest.py ...............................................................                                                                              [100%]

================================================================================== short test summary info ==================================================================================
SKIPPED [1] src/icalendar/tests/fuzzed/test_fuzzed_calendars.py: got empty parameter set ['fuzz_v1_calendar'], function test_fuzz_v1 at /home/tkloczko/rpmbuild/BUILD/icalendar-5.0.13/src/icalendar/tests/fuzzed/test_fuzzed_calendars.py:4
============================================================================== 883 passed, 1 skipped in 2.96s ===============================================================================

Closing.
Thank you.

@kloczek kloczek closed this as completed Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants