Skip to content

ErrorDetail: add __eq__/__ne__ and __repr__ #5787

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

Merged
merged 1 commit into from
Jan 30, 2018

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Jan 29, 2018

This mainly adds __eq__ to handle code in comparisons.

When comparing an ErrorDetail to a string (missing code there) the
ErrorDetail's code is ignored, but otherwise it is taken into account.

This mainly adds `__eq__` to handle `code` in comparisons.

When comparing an ErrorDetail to a string (missing `code` there) the
ErrorDetail's `code` is ignored, but otherwise it is taken into account.
@blueyed
Copy link
Contributor Author

blueyed commented Jan 29, 2018

I've stumbled across the missing __eq__ when using ErrorDetail in the test assertion for #5785.

Copy link
Collaborator

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

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

This looks OK.

@carltongibson carltongibson added this to the 3.8 Release milestone Jan 30, 2018
@carltongibson carltongibson merged commit 769bc13 into encode:master Jan 30, 2018
@blueyed blueyed deleted the errordetail-magic branch January 30, 2018 21:52
pchiquet pushed a commit to pchiquet/django-rest-framework that referenced this pull request Nov 17, 2020
This adds `__eq__` to handle `code` in comparisons.

When comparing an ErrorDetail to a string (missing `code` there) the
ErrorDetail's `code` is ignored, but otherwise it is taken into account.
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