summaryrefslogtreecommitdiff
path: root/tests/prefetch_related
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2019-10-01 17:30:02 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-10-01 17:35:55 +0200
commit6475e6318c970359a2f02798910a917229ee17d7 (patch)
tree0698bd7ff9d7077a11222d3f45a7376e7376aeca /tests/prefetch_related
parent0d4b40fe66040693074b5898c7938ea099910690 (diff)
downloaddjango-6475e6318c970359a2f02798910a917229ee17d7.tar.gz
Refs #30651 -- Added tests for Prefetch.__eq__().
Diffstat (limited to 'tests/prefetch_related')
-rw-r--r--tests/prefetch_related/tests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/prefetch_related/tests.py b/tests/prefetch_related/tests.py
index f3e0ecaddc..9ae939dcdf 100644
--- a/tests/prefetch_related/tests.py
+++ b/tests/prefetch_related/tests.py
@@ -239,6 +239,12 @@ class PrefetchRelatedTests(TestDataMixin, TestCase):
self.assertIn('prefetch_related', str(cm.exception))
self.assertIn("name", str(cm.exception))
+ def test_prefetch_eq(self):
+ prefetch_1 = Prefetch('authors', queryset=Author.objects.all())
+ prefetch_2 = Prefetch('books', queryset=Book.objects.all())
+ self.assertEqual(prefetch_1, prefetch_1)
+ self.assertNotEqual(prefetch_1, prefetch_2)
+
def test_forward_m2m_to_attr_conflict(self):
msg = 'to_attr=authors conflicts with a field on the Book model.'
authors = Author.objects.all()