1
0
mirror of https://github.com/django/django.git synced 2025-01-18 22:33:44 +00:00

Fixed #34943 -- Made EmailValidator.__eq__() ignore domain_allowlist ordering.

Signed-off-by: ksg97031 <ksg97031@gmail.com>
This commit is contained in:
ksg 2023-10-28 21:35:25 +09:00 committed by GitHub
parent 8992a0489c
commit a6c7db1d1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -244,7 +244,7 @@ class EmailValidator:
def __eq__(self, other):
return (
isinstance(other, EmailValidator)
and (self.domain_allowlist == other.domain_allowlist)
and (set(self.domain_allowlist) == set(other.domain_allowlist))
and (self.message == other.message)
and (self.code == other.code)
)

View File

@ -750,6 +750,10 @@ class TestValidatorEquality(TestCase):
EmailValidator(message="BAD EMAIL", code="bad"),
EmailValidator(message="BAD EMAIL", code="bad"),
)
self.assertEqual(
EmailValidator(allowlist=["127.0.0.1", "localhost"]),
EmailValidator(allowlist=["localhost", "127.0.0.1"]),
)
def test_basic_equality(self):
self.assertEqual(