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

redminelib/resources: add eq methods #336

Merged
merged 2 commits into from
May 16, 2024
Merged

Conversation

batrick
Copy link
Contributor

@batrick batrick commented Apr 30, 2024

To test whether, for example, a project lookedup earlier is equal to a
tracker's project.

@maxtepkeev
Copy link
Owner

Hi @batrick

Thanks for the PR.

We can surely add these methods for additional convenience, but I don't like the suggested implementation for at least 2 reasons:

  1. It doesn't support all resources
  2. It hardcodes the id attribute, but not all resources have it, for example WikiPage doesn't have id

Both issues can be easily addressed if we move the __eq__ implementation to the base class and use smth like self.__class__ for isinstance comparison and self.internal_id for equality comparison. Also we should add tests for all resources.

Please let me know if you can modify PR accordingly, or if you don't have time that's also fine, I can do this myself a bit later.

@maxtepkeev maxtepkeev self-assigned this May 5, 2024
@maxtepkeev maxtepkeev self-requested a review May 5, 2024 09:41
To test whether, for example, a project looked up earlier is equal to
the project associated with an issue or tracker.

Signed-off-by: Patrick Donnelly <batrick@batbytes.com>
@batrick
Copy link
Contributor Author

batrick commented May 10, 2024

Thanks for the review and good suggestions. Please have another look.

maxtepkeev
maxtepkeev previously approved these changes May 11, 2024
Copy link
Owner

@maxtepkeev maxtepkeev left a comment

Choose a reason for hiding this comment

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

LGTM! Tests need to be fixed though...

@maxtepkeev maxtepkeev self-requested a review May 11, 2024 14:35
@maxtepkeev maxtepkeev dismissed their stale review May 11, 2024 14:36

Tests are failing

Signed-off-by: Patrick Donnelly <batrick@batbytes.com>
@batrick
Copy link
Contributor Author

batrick commented May 14, 2024

LGTM! Tests need to be fixed though...

Please try again.

@maxtepkeev
Copy link
Owner

@batrick All good now, thanks!

There's an issue with Python 3.7 tests on MacOS, but that's out of the scope of this PR and is connected with this, so I'll fix it a bit later and merge this PR also after the fix to the tests.

@maxtepkeev maxtepkeev merged commit 832202b into maxtepkeev:master May 16, 2024
29 of 31 checks passed
maxtepkeev added a commit that referenced this pull request May 16, 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

Successfully merging this pull request may close these issues.

2 participants