summaryrefslogtreecommitdiff
path: root/tests/postgres_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/postgres_tests')
-rw-r--r--tests/postgres_tests/test_aggregates.py44
1 files changed, 1 insertions, 43 deletions
diff --git a/tests/postgres_tests/test_aggregates.py b/tests/postgres_tests/test_aggregates.py
index 621fa43d91..e3a5521f74 100644
--- a/tests/postgres_tests/test_aggregates.py
+++ b/tests/postgres_tests/test_aggregates.py
@@ -1,5 +1,3 @@
-import warnings
-
from django.db import transaction
from django.db.models import (
CharField,
@@ -17,7 +15,7 @@ from django.db.models.fields.json import KeyTransform
from django.db.models.functions import Cast, Concat, LPad, Substr
from django.test.utils import Approximate
from django.utils import timezone
-from django.utils.deprecation import RemovedInDjango61Warning, RemovedInDjango70Warning
+from django.utils.deprecation import RemovedInDjango70Warning
from . import PostgreSQLTestCase
from .models import AggregateTestModel, HotelReservation, Room, StatTestModel
@@ -147,46 +145,6 @@ class TestGeneralAggregate(PostgreSQLTestCase):
)
self.assertEqual(values, {"aggregation": expected_result})
- def test_ordering_warns_of_deprecation(self):
- msg = "The ordering argument is deprecated. Use order_by instead."
- with self.assertWarnsMessage(RemovedInDjango61Warning, msg) as ctx:
- values = AggregateTestModel.objects.aggregate(
- arrayagg=ArrayAgg("integer_field", ordering=F("integer_field").desc())
- )
- self.assertEqual(values, {"arrayagg": [2, 1, 0, 0]})
- self.assertEqual(ctx.filename, __file__)
-
- # RemovedInDjango61Warning: Remove this test
- def test_ordering_and_order_by_causes_error(self):
- with warnings.catch_warnings(record=True, action="always") as wm:
- with self.assertRaisesMessage(
- TypeError,
- "Cannot specify both order_by and ordering.",
- ):
- AggregateTestModel.objects.aggregate(
- stringagg=StringAgg(
- "char_field",
- delimiter=Value("'"),
- order_by="char_field",
- ordering="char_field",
- )
- )
-
- first_warning = wm[0]
- self.assertEqual(first_warning.category, RemovedInDjango70Warning)
- self.assertEqual(
- "The PostgreSQL specific StringAgg function is deprecated. Use "
- "django.db.models.aggregate.StringAgg instead.",
- str(first_warning.message),
- )
-
- second_warning = wm[1]
- self.assertEqual(second_warning.category, RemovedInDjango61Warning)
- self.assertEqual(
- "The ordering argument is deprecated. Use order_by instead.",
- str(second_warning.message),
- )
-
def test_array_agg_charfield(self):
values = AggregateTestModel.objects.aggregate(arrayagg=ArrayAgg("char_field"))
self.assertEqual(values, {"arrayagg": ["Foo1", "Foo2", "Foo4", "Foo3"]})