Opened 7 years ago

Last modified 4 years ago

#28507 closed New feature

Allow ValidationErrors to equal each other when created identically — at Version 1

Reported by: kamni Owned by: nobody
Component: Core (Other) Version: dev
Severity: Normal Keywords: ValidationError
Cc: Markus Holtermann Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by kamni)

Currently ValidationErrors (django.core.exceptions.ValidationError) that have identical messages don't equal each other, which is counter-intuitive, and can make certain kinds of testing more complicated. Please add an __eq__ method that allows two ValidationErrors to be compared.

Ideally, this would be more than just a simple self.messages == other.messages. It would be most helpful if the comparison were independent of the order in which errors were raised in a field or in non_field_errors.

Change History (1)

comment:1 by kamni, 7 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top