1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Refs #35405 -- Adjusted deprecation warning stacklevel in FieldCacheMixin.get_cache_name().

This commit is contained in:
Simon Charette
2024-08-09 12:55:40 -04:00
committed by nessita
parent 47f18a7226
commit 39abd56a7f
3 changed files with 7 additions and 1 deletions

View File

@@ -34,9 +34,10 @@ class FieldCacheMixinTests(SimpleTestCase):
# RemovedInDjango60Warning.
def test_get_cache_name_deprecated(self):
msg = "Override ExampleOld.cache_name instead of get_cache_name()."
with self.assertWarnsMessage(RemovedInDjango60Warning, msg):
with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
result = ExampleOld().cache_name
self.assertEqual(result, "example")
self.assertEqual(ctx.filename, __file__)
def test_cache_name(self):
result = Example().cache_name