diff options
| author | Tim Graham <timograham@gmail.com> | 2015-09-01 10:15:59 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-09-23 19:31:10 -0400 |
| commit | fd6a299cd06fac615ccb9006df0dd98cd8461cc5 (patch) | |
| tree | c2a19b2eafd05e786be4d861e389c347a7bc3d9a /tests/aggregation | |
| parent | 7140d4adf724347aceda1cec7d194f0403fba027 (diff) | |
Refs #14030 -- Removed backwards compatiblity for old-style aggregates.
Per deprecation timeline.
Diffstat (limited to 'tests/aggregation')
| -rw-r--r-- | tests/aggregation/tests.py | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py index a1d12e363e..3fa36bbcb5 100644 --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -7,13 +7,12 @@ from decimal import Decimal from django.core.exceptions import FieldError from django.db import connection from django.db.models import ( - F, Aggregate, Avg, Count, DecimalField, DurationField, FloatField, Func, - IntegerField, Max, Min, Sum, Value, + F, Avg, Count, DecimalField, DurationField, FloatField, Func, IntegerField, + Max, Min, Sum, Value, ) -from django.test import TestCase, ignore_warnings +from django.test import TestCase from django.test.utils import Approximate, CaptureQueriesContext from django.utils import six, timezone -from django.utils.deprecation import RemovedInDjango110Warning from .models import Author, Book, Publisher, Store @@ -1184,23 +1183,3 @@ class AggregateTestCase(TestCase): ).filter(rating_or_num_awards__gt=F('num_awards')).order_by('num_awards') self.assertQuerysetEqual( qs2, [1, 3], lambda v: v.num_awards) - - @ignore_warnings(category=RemovedInDjango110Warning) - def test_backwards_compatibility(self): - from django.db.models.sql import aggregates as sql_aggregates - - class SqlNewSum(sql_aggregates.Aggregate): - sql_function = 'SUM' - - class NewSum(Aggregate): - name = 'Sum' - - def add_to_query(self, query, alias, col, source, is_summary): - klass = SqlNewSum - aggregate = klass( - col, source=source, is_summary=is_summary, **self.extra) - query.annotations[alias] = aggregate - - qs = Author.objects.values('name').annotate(another_age=NewSum('age') + F('age')) - a = qs.get(name="Adrian Holovaty") - self.assertEqual(a['another_age'], 68) |
