1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Refs #25466 -- Removed unused DeprecationInstanceCheck.

Unused since ff419de263.
This commit is contained in:
Adam Johnson 2024-06-27 21:42:57 +01:00 committed by Sarah Boyce
parent b2fec1f08d
commit 86e13843c2
2 changed files with 1 additions and 27 deletions

View File

@ -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

View File

@ -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)