mirror of
https://github.com/django/django.git
synced 2025-08-10 11:59:13 +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):
|
def __eq__(self, other):
|
||||||
return (
|
return (
|
||||||
isinstance(other, self.__class__)
|
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.message == other.message
|
||||||
and self.code == other.code
|
and self.code == other.code
|
||||||
)
|
)
|
||||||
|
@ -804,6 +804,10 @@ class TestValidatorEquality(TestCase):
|
|||||||
FileExtensionValidator(["TXT", "png"]),
|
FileExtensionValidator(["TXT", "png"]),
|
||||||
FileExtensionValidator(["txt", "png"]),
|
FileExtensionValidator(["txt", "png"]),
|
||||||
)
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
FileExtensionValidator(["jpg", "png", "txt"]),
|
||||||
|
FileExtensionValidator(["txt", "jpg", "png"]),
|
||||||
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
FileExtensionValidator(["txt"]),
|
FileExtensionValidator(["txt"]),
|
||||||
FileExtensionValidator(["txt"], code="invalid_extension"),
|
FileExtensionValidator(["txt"], code="invalid_extension"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user