summaryrefslogtreecommitdiff
path: root/tests/prefetch_related
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/prefetch_related
parent6475e6318c970359a2f02798910a917229ee17d7 (diff)
downloaddjango-54ea290e5bbd19d87bd8dba807738eeeaf01a362.tar.gz
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/prefetch_related')
-rw-r--r--tests/prefetch_related/tests.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/prefetch_related/tests.py b/tests/prefetch_related/tests.py
index 9ae939dcdf..930ba9fbc8 100644
--- a/tests/prefetch_related/tests.py
+++ b/tests/prefetch_related/tests.py
@@ -1,3 +1,5 @@
+from unittest import mock
+
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
@@ -243,6 +245,7 @@ class PrefetchRelatedTests(TestDataMixin, TestCase):
prefetch_1 = Prefetch('authors', queryset=Author.objects.all())
prefetch_2 = Prefetch('books', queryset=Book.objects.all())
self.assertEqual(prefetch_1, prefetch_1)
+ self.assertEqual(prefetch_1, mock.ANY)
self.assertNotEqual(prefetch_1, prefetch_2)
def test_forward_m2m_to_attr_conflict(self):