summaryrefslogtreecommitdiff
path: root/tests/postgres_tests/test_constraints.py
diff options
context:
space:
mode:
authorElizabethU <elizabeth.uselton@gmail.com>2019-09-02 19:09:31 -0700
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-10-01 17:58:19 +0200
commit54ea290e5bbd19d87bd8dba807738eeeaf01a362 (patch)
treed83c186bde9f50faa13840e6ee227e3bb1e02ad6 /tests/postgres_tests/test_constraints.py
parent6475e6318c970359a2f02798910a917229ee17d7 (diff)
Fixed #30651 -- Made __eq__() methods return NotImplemented for not implemented comparisons.
Changed __eq__ to return NotImplemented instead of False if compared to an object of the same type, as is recommended by the Python data model reference. Now these models can be compared to ANY (or other objects with __eq__ overwritten) without returning False automatically.
Diffstat (limited to 'tests/postgres_tests/test_constraints.py')
-rw-r--r--tests/postgres_tests/test_constraints.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_constraints.py b/tests/postgres_tests/test_constraints.py
index d8665f59f6..b22821294a 100644
--- a/tests/postgres_tests/test_constraints.py
+++ b/tests/postgres_tests/test_constraints.py
@@ -1,4 +1,5 @@
import datetime
+from unittest import mock
from django.db import connection, transaction
from django.db.models import F, Func, Q
@@ -175,6 +176,7 @@ class ExclusionConstraintTests(PostgreSQLTestCase):
condition=Q(cancelled=False),
)
self.assertEqual(constraint_1, constraint_1)
+ self.assertEqual(constraint_1, mock.ANY)
self.assertNotEqual(constraint_1, constraint_2)
self.assertNotEqual(constraint_1, constraint_3)
self.assertNotEqual(constraint_2, constraint_3)