summaryrefslogtreecommitdiff
path: root/tests/annotations
diff options
context:
space:
mode:
authorRaj Desai <rajdesai024@gmail.com>2023-01-20 03:15:05 +0530
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-01-26 19:54:48 +0100
commit246eb4836a6fb967880f838aa0d22ecfdca8b6f1 (patch)
tree3618293443a815b7c16a007b410005dc83e835d9 /tests/annotations
parent7eb5391b71f473dd13abdaaef143a5509160487f (diff)
downloaddjango-246eb4836a6fb967880f838aa0d22ecfdca8b6f1.tar.gz
Fixed #34254 -- Fixed return value of Exists() with empty queryset.
Thanks Simon Charette for reviews.
Diffstat (limited to 'tests/annotations')
-rw-r--r--tests/annotations/tests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
index d05af552b4..e0cdbf1e0b 100644
--- a/tests/annotations/tests.py
+++ b/tests/annotations/tests.py
@@ -1017,6 +1017,14 @@ class NonAggregateAnnotationTestCase(TestCase):
],
)
+ def test_annotation_exists_none_query(self):
+ self.assertIs(
+ Author.objects.annotate(exists=Exists(Company.objects.none()))
+ .get(pk=self.a1.pk)
+ .exists,
+ False,
+ )
+
def test_annotation_exists_aggregate_values_chaining(self):
qs = (
Book.objects.values("publisher")