Skip to content

Commit

Permalink
Defined output_field of Func() in test_grouping_by_annotations_with_a…
Browse files Browse the repository at this point in the history
…rray_field_param().

output_field cannot be automatically determined because the first
argument passed to ARRAY_LEN is an ArrayField and the second one is an
integer.
  • Loading branch information
charettes authored and felixxm committed Jun 24, 2020
1 parent 2afa61e commit 5227101
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/postgres_tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,9 @@ def test_grouping_by_annotations_with_array_field_param(self):
value = models.Value([1], output_field=ArrayField(models.IntegerField()))
self.assertEqual(
NullableIntegerArrayModel.objects.annotate(
array_length=models.Func(value, 1, function='ARRAY_LENGTH'),
array_length=models.Func(
value, 1, function='ARRAY_LENGTH', output_field=models.IntegerField(),
),
).values('array_length').annotate(
count=models.Count('pk'),
).get()['array_length'],
Expand Down

0 comments on commit 5227101

Please sign in to comment.