mirror of
https://github.com/django/django.git
synced 2025-08-18 17:50:58 +00:00
[5.2.x] Fixed #35235 -- Removed caching of BaseExpression._output_field_or_none.
Backport of cbb0812683
from main.
This commit is contained in:
parent
d567e3a52e
commit
77f9e6bcd3
3 changed files with 37 additions and 7 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue