summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSicong <jiasicong@gmail.com>2020-11-02 22:08:42 -0800
committerGitHub <noreply@github.com>2020-11-03 07:08:42 +0100
commit09e1ec71dfd1e43ae422f5f9bf4525936832e0ce (patch)
tree20bf6f7f145cae8eed4f7338ffc680dd4d0b7e23 /tests
parentcfc7cd6513a72b8c5898c264d04bdf49f897a1de (diff)
Fixed #32166 -- Removed redundant definition of Greatest in test_expression_on_aggregation.
Diffstat (limited to 'tests')
-rw-r--r--tests/aggregation/tests.py12
1 files changed, 2 insertions, 10 deletions
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py
index a759fd4d36..62704c4bd2 100644
--- a/tests/aggregation/tests.py
+++ b/tests/aggregation/tests.py
@@ -5,10 +5,10 @@ from decimal import Decimal
from django.core.exceptions import FieldError
from django.db import connection
from django.db.models import (
- Avg, Case, Count, DecimalField, DurationField, Exists, F, FloatField, Func,
+ Avg, Case, Count, DecimalField, DurationField, Exists, F, FloatField,
IntegerField, Max, Min, OuterRef, Subquery, Sum, Value, When,
)
-from django.db.models.functions import Coalesce
+from django.db.models.functions import Coalesce, Greatest
from django.test import TestCase
from django.test.testcases import skipUnlessDBFeature
from django.test.utils import Approximate, CaptureQueriesContext
@@ -1102,14 +1102,6 @@ class AggregateTestCase(TestCase):
{'books_per_rating__max': 3 + 5})
def test_expression_on_aggregation(self):
-
- # Create a plain expression
- class Greatest(Func):
- function = 'GREATEST'
-
- def as_sqlite(self, compiler, connection, **extra_context):
- return super().as_sql(compiler, connection, function='MAX', **extra_context)
-
qs = Publisher.objects.annotate(
price_or_median=Greatest(Avg('book__rating', output_field=DecimalField()), Avg('book__price'))
).filter(price_or_median__gte=F('num_awards')).order_by('num_awards')