diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/postgres_tests/test_aggregates.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/postgres_tests/test_aggregates.py b/tests/postgres_tests/test_aggregates.py index 386c55da25..7e1e16d0c0 100644 --- a/tests/postgres_tests/test_aggregates.py +++ b/tests/postgres_tests/test_aggregates.py @@ -12,7 +12,7 @@ from django.db.models import ( Window, ) from django.db.models.fields.json import KeyTextTransform, KeyTransform -from django.db.models.functions import Cast, Concat, Substr +from django.db.models.functions import Cast, Concat, LPad, Substr from django.test import skipUnlessDBFeature from django.test.utils import Approximate from django.utils import timezone @@ -238,6 +238,16 @@ class TestGeneralAggregate(PostgreSQLTestCase): ) self.assertEqual(values, {"arrayagg": ["en", "pl"]}) + def test_array_agg_filter_and_ordering_params(self): + values = AggregateTestModel.objects.aggregate( + arrayagg=ArrayAgg( + "char_field", + filter=Q(json_field__has_key="lang"), + ordering=LPad(Cast("integer_field", CharField()), 2, Value("0")), + ) + ) + self.assertEqual(values, {"arrayagg": ["Foo2", "Foo4"]}) + def test_array_agg_filter(self): values = AggregateTestModel.objects.aggregate( arrayagg=ArrayAgg("integer_field", filter=Q(integer_field__gt=0)), |
