summaryrefslogtreecommitdiff
path: root/tests/annotations/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/annotations/tests.py')
-rw-r--r--tests/annotations/tests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
index c0fe308a07..62912ee99c 100644
--- a/tests/annotations/tests.py
+++ b/tests/annotations/tests.py
@@ -210,6 +210,12 @@ class NonAggregateAnnotationTestCase(TestCase):
self.assertEqual(len(books), Book.objects.count())
self.assertTrue(all(not book.selected for book in books))
+ def test_empty_queryset_annotation(self):
+ qs = Author.objects.annotate(
+ empty=Subquery(Author.objects.values('id').none())
+ )
+ self.assertIsNone(qs.first().empty)
+
def test_annotate_with_aggregation(self):
books = Book.objects.annotate(is_book=Value(1), rating_count=Count('rating'))
for book in books: