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:
parent
8992a0489c
commit
a6c7db1d1d
@ -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)
|
||||
)
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user