diff options
| -rw-r--r-- | django/core/validators.py | 3 | ||||
| -rw-r--r-- | tests/validators/tests.py | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/django/core/validators.py b/django/core/validators.py index fe8d46526a..a5641d85b3 100644 --- a/django/core/validators.py +++ b/django/core/validators.py @@ -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 ) diff --git a/tests/validators/tests.py b/tests/validators/tests.py index cf64638ebb..cae64045bd 100644 --- a/tests/validators/tests.py +++ b/tests/validators/tests.py @@ -805,6 +805,10 @@ class TestValidatorEquality(TestCase): FileExtensionValidator(["txt", "png"]), ) self.assertEqual( + FileExtensionValidator(["jpg", "png", "txt"]), + FileExtensionValidator(["txt", "jpg", "png"]), + ) + self.assertEqual( FileExtensionValidator(["txt"]), FileExtensionValidator(["txt"], code="invalid_extension"), ) |
