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

Compare test calendars to find components that do not equal #575

Merged
merged 12 commits into from
Nov 2, 2023

Conversation

niccokunzmann
Copy link
Member

@niccokunzmann niccokunzmann commented Nov 1, 2023

This contributes to #570.

  • move .ics files into their folders
  • create tests from the example files to check which values do not compare
  • test inequality of the components/properties
  • implement an equality function

@niccokunzmann
Copy link
Member Author

The tests run here but weirdly they do not on my computer. There is just one failing!

    def test_parsed_calendars_are_equal_if_from_same_source(ics_file):
        """Ensure that a calendar equals the same calendar."""
        same_calendar = ics_file.__class__.from_ical(ics_file.raw_ics)
>       assert same_calendar == ics_file
E       assert VCALENDAR({'VERSION': vText('b'2.0''), 'PRODID': vText('b'icalendar-2023'')}, VEVENT({'UID': vText('b'ical-jacadzaca-3''), 'SUMMARY': vText('b" Some very different event ':'"'), 'DTSTART': vDDDTypes(2021-11-01 16:00:00+01:00, Parameters({'TZID': 'Western/Central Europe', 'VALUE': 'DATE-TIME'})), 'DTEND': vDDDTypes(2021-11-01 16:30:00+01:00, Parameters({'TZID': 'Western/Central Europe', 'VALUE': 'DATE-TIME'})), 'DTSTAMP': vDDDTypes(2021-10-04 15:02:45+00:00, Parameters({}))}), VEVENT({'UID': vText('b'ical-jacadzaca-4''), 'SUMMARY': vText('b' Some very different other event''), 'DTSTART': vDDDTypes(2021-11-01 16:40:00+01:00, Parameters({'TZID': 'Western/Central Europe', 'VALUE': 'DATE-TIME'})), 'DTEND': vDDDTypes(2021-11-01 16:50:00+01:00, Parameters({'TZID': 'Western/Central Europe', 'VALUE': 'DATE-TIME'})), 'DTSTAMP': vDDDTypes(2021-10-04 15:02:45+00:00, Parameters({}))})) == VCALENDAR({'VERSION': vText('b'2.0''), 'PRODID': vText('b'icalendar-2023'')}, VEVENT({'UID': vText('b'ical-jacadzaca-3''), 'SUMMARY': vText('b" Some very different event ':'"'), 'DTSTART': vDDDTypes(2021-11-01 16:00:00, Parameters({'TZID': 'Western/Central Europe', 'VALUE': 'DATE-TIME'})), 'DTEND': vDDDTypes(2021-11-01 16:30:00, Parameters({'TZID': 'Western/Central Europe', 'VALUE': 'DATE-TIME'})), 'DTSTAMP': vDDDTypes(2021-10-04 15:02:45+00:00, Parameters({}))}), VEVENT({'UID': vText('b'ical-jacadzaca-4''), 'SUMMARY': vText('b' Some very different other event''), 'DTSTART': vDDDTypes(2021-11-01 16:40:00, Parameters({'TZID': 'Western/Central Europe', 'VALUE': 'DATE-TIME'})), 'DTEND': vDDDTypes(2021-11-01 16:50:00, Parameters({'TZID': 'Western/Central Europe', 'VALUE': 'DATE-TIME'})), 'DTSTAMP': vDDDTypes(2021-10-04 15:02:45+00:00, Parameters({}))}))
E         Common items:
E         {'PRODID': vText('b'icalendar-2023''), 'VERSION': vText('b'2.0'')}
E         Full diff:
E           {
E            'PRODID': vText('b'icalendar-2023''),
E            'VERSION': vText('b'2.0''),
E           }

src/icalendar/tests/test_equality.py:19: AssertionError
------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------
issue_526_calendar_with_different_events

Difference when the same calendar is read twice from the same source:

'DTSTART': vDDDTypes(2021-11-01 16:00:00+01:00, Parameters({'TZID': 'Western/Central Europe', 'VALUE': 'DATE-TIME'})), ==
'DTSTART': vDDDTypes(2021-11-01 16:00:00,       Parameters({'TZID': 'Western/Central Europe', 'VALUE': 'DATE-TIME'}))

@niccokunzmann
Copy link
Member Author

Please review this. I would like to make a release after this merge - it is even worth releasing before that if it takes longer.

One fix is that == was implemented but != still used the old behavior and with that a == b did not mean not a != b or vice versa. That should be a big problem if you wanted to compare calendars.

src/icalendar/tests/conftest.py Show resolved Hide resolved
src/icalendar/tests/test_timezoned.py Outdated Show resolved Hide resolved
@angatha angatha self-requested a review November 2, 2023 19:04
@niccokunzmann
Copy link
Member Author

@angatha, if you like, you can also merge! (No pressure - I just like to ship all the contributions) Also, you can start a new release if you like. <- Please see these as invitations!

src/icalendar/prop.py Outdated Show resolved Hide resolved
@angatha
Copy link
Collaborator

angatha commented Nov 2, 2023

@angatha, if you like, you can also merge! (No pressure - I just like to ship all the contributions) Also, you can start a new release if you like. <- Please see these as invitations!

Thank you :) I haven't done a release and are bussy right now. But @jacadzaca requested a change anyway.

@jacadzaca jacadzaca merged commit 9ce1fa8 into collective:master Nov 2, 2023
13 checks passed
@niccokunzmann niccokunzmann deleted the comparing branch November 3, 2023 16:47
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

Successfully merging this pull request may close these issues.

None yet

3 participants