mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #30548 -- Improved exception when expression contains mixed types.
This commit is contained in:
parent
03cd3d137e
commit
34f8eeea4a
2 changed files with 13 additions and 3 deletions
|
@ -884,7 +884,10 @@ class AggregateTestCase(TestCase):
|
|||
self.assertEqual(p2, {'avg_price': Approximate(Decimal('53.39'), places=2)})
|
||||
|
||||
def test_combine_different_types(self):
|
||||
msg = 'Expression contains mixed types. You must set output_field.'
|
||||
msg = (
|
||||
'Expression contains mixed types: FloatField, IntegerField. '
|
||||
'You must set output_field.'
|
||||
)
|
||||
qs = Book.objects.annotate(sums=Sum('rating') + Sum('pages') + Sum('price'))
|
||||
with self.assertRaisesMessage(FieldError, msg):
|
||||
qs.first()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue