summaryrefslogtreecommitdiff
path: root/tests/model_fields
diff options
context:
space:
mode:
authorSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-12-13 09:33:45 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-01-15 22:28:37 +0100
commitbc3f3031d8ae0b689d02a427f33df24a90cf54c1 (patch)
tree6cbb62607599f28606736d37459859ebfef650c4 /tests/model_fields
parent85750bd2f8ed7e595aac25c7e5fd7218528a25b1 (diff)
Refs #35405 -- Removed FieldCacheMixin.get_cache_name() per deprecation timeline.
Diffstat (limited to 'tests/model_fields')
-rw-r--r--tests/model_fields/test_mixins.py23
1 files changed, 2 insertions, 21 deletions
diff --git a/tests/model_fields/test_mixins.py b/tests/model_fields/test_mixins.py
index 8847f25987..f3412eed3a 100644
--- a/tests/model_fields/test_mixins.py
+++ b/tests/model_fields/test_mixins.py
@@ -1,17 +1,10 @@
from django.db.models.fields.mixins import FieldCacheMixin
from django.test import SimpleTestCase
-from django.utils.deprecation import RemovedInDjango60Warning
from django.utils.functional import cached_property
from .models import Foo
-# RemovedInDjango60Warning.
-class ExampleOld(FieldCacheMixin):
- def get_cache_name(self):
- return "example"
-
-
class Example(FieldCacheMixin):
@cached_property
def cache_name(self):
@@ -23,21 +16,9 @@ class FieldCacheMixinTests(SimpleTestCase):
self.instance = Foo()
self.field = Example()
- # RemovedInDjango60Warning: when the deprecation ends, replace with:
- # def test_cache_name_not_implemented(self):
- # with self.assertRaises(NotImplementedError):
- # FieldCacheMixin().cache_name
- def test_get_cache_name_not_implemented(self):
+ def test_cache_name_not_implemented(self):
with self.assertRaises(NotImplementedError):
- FieldCacheMixin().get_cache_name()
-
- # RemovedInDjango60Warning.
- def test_get_cache_name_deprecated(self):
- msg = "Override ExampleOld.cache_name instead of get_cache_name()."
- with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
- result = ExampleOld().cache_name
- self.assertEqual(result, "example")
- self.assertEqual(ctx.filename, __file__)
+ FieldCacheMixin().cache_name
def test_cache_name(self):
result = Example().cache_name