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

implement hash and __eq__ for vDDDTypes #492

Merged
merged 6 commits into from Nov 17, 2022

Conversation

niccokunzmann
Copy link
Member

@niccokunzmann niccokunzmann commented Nov 10, 2022

This adds tests and an implementation of __hash__ for vDDDTypes to fix #487.

  • add __hash__
  • add .dt comparison to __eq__ so that the equality is really tested.

@@ -518,6 +500,38 @@ def test_prop_TypesFactory(self):
)



vDDDTypes_list = [
vDDDTypes(pytz.timezone('US/Eastern').localize(datetime(year=2022, month=7, day=22, hour=12, minute=7))),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this use the in_timezone fixture from the conftest.py?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to add not too much. Hm. Since many of the arguments do not use a tz, that would create redundant tests.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain how would they be redundant? I don't quite get that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A second or third case with timezone should do the job too. One with same timezone and one with different time zone but same instant in time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In ae9ac71 I added another time zone. I think, this covers the case:

  • time zone differs
  • time zone different from no time zone

Since no time zone is also a time zone in my view, all the cases would be covered. What do you think?

src/icalendar/tests/test_unit_prop.py Outdated Show resolved Hide resolved
src/icalendar/prop.py Show resolved Hide resolved
src/icalendar/tests/test_unit_prop.py Show resolved Hide resolved
src/icalendar/tests/test_unit_prop.py Show resolved Hide resolved
@jacadzaca jacadzaca merged commit b4b30ab into master Nov 17, 2022
@niccokunzmann niccokunzmann deleted the 487-regression-dddtype-not-hashable-in-icalendar-5 branch November 23, 2022 17:48
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.

[REGRESSION] DDDType not hashable in icalendar 5
3 participants