diff options
| author | sharonwoo <29156885+sharonwoo@users.noreply.github.com> | 2024-09-27 09:17:07 +0800 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-01-30 13:51:25 +0100 |
| commit | 77f9e6bcd3302eda1a2f9f9e2ce5ac8983b37951 (patch) | |
| tree | aa2593b391dc868a805751585f945d4c2008d3ce /tests/postgres_tests | |
| parent | d567e3a52e8b3ef0f830e07b602ae1382657eb07 (diff) | |
[5.2.x] Fixed #35235 -- Removed caching of BaseExpression._output_field_or_none.
Backport of cbb0812683cf3236e4a4003bf7f74b119d3cde0c from main.
Diffstat (limited to 'tests/postgres_tests')
| -rw-r--r-- | tests/postgres_tests/test_aggregates.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_aggregates.py b/tests/postgres_tests/test_aggregates.py index 885512cfca..ddd3b6bbd0 100644 --- a/tests/postgres_tests/test_aggregates.py +++ b/tests/postgres_tests/test_aggregates.py @@ -334,6 +334,22 @@ class TestGeneralAggregate(PostgreSQLTestCase): ) self.assertCountEqual(qs, [[], [5]]) + def test_array_agg_with_empty_filter_and_default_values(self): + for filter_value in ([-1], []): + for default_value in ([], Value([])): + with self.subTest(filter=filter_value, default=default_value): + queryset = AggregateTestModel.objects.annotate( + test_array_agg=ArrayAgg( + "stattestmodel__int1", + filter=Q(pk__in=filter_value), + default=default_value, + ) + ) + self.assertSequenceEqual( + queryset.values_list("test_array_agg", flat=True), + [[], [], [], []], + ) + def test_bit_and_general(self): values = AggregateTestModel.objects.filter(integer_field__in=[0, 1]).aggregate( bitand=BitAnd("integer_field") |
