mirror of
https://github.com/django/django.git
synced 2025-02-03 14:16:52 +00:00
Fixed #34920 -- Made FileExtensionValidator.__eq__() ignore allowed_extensions ordering.
This commit is contained in:
parent
171f91d9ef
commit
d22ba07630
@ -595,7 +595,8 @@ class FileExtensionValidator:
|
||||
def __eq__(self, other):
|
||||
return (
|
||||
isinstance(other, self.__class__)
|
||||
and self.allowed_extensions == other.allowed_extensions
|
||||
and set(self.allowed_extensions or [])
|
||||
== set(other.allowed_extensions or [])
|
||||
and self.message == other.message
|
||||
and self.code == other.code
|
||||
)
|
||||
|
@ -804,6 +804,10 @@ class TestValidatorEquality(TestCase):
|
||||
FileExtensionValidator(["TXT", "png"]),
|
||||
FileExtensionValidator(["txt", "png"]),
|
||||
)
|
||||
self.assertEqual(
|
||||
FileExtensionValidator(["jpg", "png", "txt"]),
|
||||
FileExtensionValidator(["txt", "jpg", "png"]),
|
||||
)
|
||||
self.assertEqual(
|
||||
FileExtensionValidator(["txt"]),
|
||||
FileExtensionValidator(["txt"], code="invalid_extension"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user