summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2024-06-27 21:42:57 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-07-11 09:40:07 +0200
commit86e13843c2ab510fba1de84588efe7fd03555531 (patch)
treeb70445682c6af0dd3b73507e63709d0a525c9811
parentb2fec1f08df316e26ff2c756ff23a9605746a864 (diff)
Refs #25466 -- Removed unused DeprecationInstanceCheck.
Unused since ff419de263138e905dff44c5cb806310c70f32aa.
-rw-r--r--django/utils/deprecation.py10
-rw-r--r--tests/deprecation/tests.py18
2 files changed, 1 insertions, 27 deletions
diff --git a/django/utils/deprecation.py b/django/utils/deprecation.py
index 9d3c628f66..d690dc5d56 100644
--- a/django/utils/deprecation.py
+++ b/django/utils/deprecation.py
@@ -83,16 +83,6 @@ class RenameMethodsBase(type):
return new_class
-class DeprecationInstanceCheck(type):
- def __instancecheck__(self, instance):
- warnings.warn(
- "`%s` is deprecated, use `%s` instead." % (self.__name__, self.alternative),
- self.deprecation_warning,
- 2,
- )
- return super().__instancecheck__(instance)
-
-
class MiddlewareMixin:
sync_capable = True
async_capable = True
diff --git a/tests/deprecation/tests.py b/tests/deprecation/tests.py
index b64691eb55..5548e90285 100644
--- a/tests/deprecation/tests.py
+++ b/tests/deprecation/tests.py
@@ -1,12 +1,7 @@
import warnings
from django.test import SimpleTestCase
-from django.utils.deprecation import (
- DeprecationInstanceCheck,
- RemovedAfterNextVersionWarning,
- RemovedInNextVersionWarning,
- RenameMethodsBase,
-)
+from django.utils.deprecation import RemovedAfterNextVersionWarning, RenameMethodsBase
class RenameManagerMethods(RenameMethodsBase):
@@ -166,14 +161,3 @@ class RenameMethodsTests(SimpleTestCase):
self.assertTrue(
issubclass(RemovedAfterNextVersionWarning, PendingDeprecationWarning)
)
-
-
-class DeprecationInstanceCheckTest(SimpleTestCase):
- def test_warning(self):
- class Manager(metaclass=DeprecationInstanceCheck):
- alternative = "fake.path.Foo"
- deprecation_warning = RemovedInNextVersionWarning
-
- msg = "`Manager` is deprecated, use `fake.path.Foo` instead."
- with self.assertWarnsMessage(RemovedInNextVersionWarning, msg):
- isinstance(object, Manager)