diff options
| author | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-12-12 16:42:20 +0100 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-01-15 22:28:37 +0100 |
| commit | 6b271ef21de31911f3ad7712341e3932936bd140 (patch) | |
| tree | ca42fed374f9ea0f9f6c72a57d031cdc71934a2e /tests/backends | |
| parent | ba90b76c6e5e8731b0ba9f52a3ccc0651489ef3b (diff) | |
Refs #34547 -- Removed DatabaseOperations.field_cast_sql() per deprecation timeline.
Diffstat (limited to 'tests/backends')
| -rw-r--r-- | tests/backends/base/test_operations.py | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/tests/backends/base/test_operations.py b/tests/backends/base/test_operations.py index 3223550446..a0bd50351c 100644 --- a/tests/backends/base/test_operations.py +++ b/tests/backends/base/test_operations.py @@ -1,12 +1,10 @@ import decimal -from unittest import mock from django.core.management.color import no_style from django.db import NotSupportedError, connection, transaction from django.db.backends.base.operations import BaseDatabaseOperations from django.db.models import DurationField from django.db.models.expressions import Col -from django.db.models.lookups import Exact from django.test import ( SimpleTestCase, TestCase, @@ -15,7 +13,6 @@ from django.test import ( skipIfDBFeature, ) from django.utils import timezone -from django.utils.deprecation import RemovedInDjango60Warning from ..models import Author, Book @@ -224,25 +221,3 @@ class SqlFlushTests(TransactionTestCase): self.assertEqual(author.pk, 1) book = Book.objects.create(author=author) self.assertEqual(book.pk, 1) - - -class DeprecationTests(TestCase): - def test_field_cast_sql_warning(self): - base_ops = BaseDatabaseOperations(connection=connection) - msg = ( - "DatabaseOperations.field_cast_sql() is deprecated use " - "DatabaseOperations.lookup_cast() instead." - ) - with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx: - base_ops.field_cast_sql("integer", "IntegerField") - self.assertEqual(ctx.filename, __file__) - - def test_field_cast_sql_usage_warning(self): - compiler = Author.objects.all().query.get_compiler(connection.alias) - msg = ( - "The usage of DatabaseOperations.field_cast_sql() is deprecated. Implement " - "DatabaseOperations.lookup_cast() instead." - ) - with mock.patch.object(connection.ops.__class__, "field_cast_sql"): - with self.assertRaisesMessage(RemovedInDjango60Warning, msg): - Exact("name", "book__author__name").as_sql(compiler, connection) |
