diff options
Diffstat (limited to 'tests/aggregation')
| -rw-r--r-- | tests/aggregation/test_filter_argument.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/aggregation/test_filter_argument.py b/tests/aggregation/test_filter_argument.py index caf2cd3d6f..3ef0401d4d 100644 --- a/tests/aggregation/test_filter_argument.py +++ b/tests/aggregation/test_filter_argument.py @@ -205,3 +205,16 @@ class FilteredAggregateTests(TestCase): max_rating=Max("rating", filter=Q(rating__in=[])) ) self.assertEqual(aggregate, {"max_rating": None}) + + def test_filtered_aggregate_full_condition(self): + book = Book.objects.annotate( + authors_count=Count( + "authors", + filter=~Q(authors__in=[]), + ), + ).get(pk=self.b1.pk) + self.assertEqual(book.authors_count, 2) + aggregate = Book.objects.aggregate( + max_rating=Max("rating", filter=~Q(rating__in=[])) + ) + self.assertEqual(aggregate, {"max_rating": 4.5}) |
