mirror of
https://github.com/django/django.git
synced 2025-08-10 05:48:15 +00:00
[1.8.x] Fixed small inconsistency when handling aggregate's default_alias.
Refs #14030.
Backport of d450af8a26
from master
This commit is contained in:
parent
45aaced91e
commit
0580133971
2 changed files with 15 additions and 5 deletions
|
@ -768,10 +768,12 @@ class ComplexAggregateTestCase(TestCase):
|
|||
self.assertEqual(b3.sums, Approximate(Decimal("383.69"), places=2))
|
||||
|
||||
def test_complex_aggregations_require_kwarg(self):
|
||||
with six.assertRaisesRegex(self, TypeError, 'Complex expressions require an alias'):
|
||||
with six.assertRaisesRegex(self, TypeError, 'Complex annotations require an alias'):
|
||||
Author.objects.annotate(Sum(F('age') + F('friends__age')))
|
||||
with six.assertRaisesRegex(self, TypeError, 'Complex aggregates require an alias'):
|
||||
Author.objects.aggregate(Sum('age') / Count('age'))
|
||||
with six.assertRaisesRegex(self, TypeError, 'Complex aggregates require an alias'):
|
||||
Author.objects.aggregate(Sum(Value(1)))
|
||||
|
||||
def test_aggregate_over_complex_annotation(self):
|
||||
qs = Author.objects.annotate(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue