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:
parent
b2fec1f08d
commit
86e13843c2
@ -83,16 +83,6 @@ class RenameMethodsBase(type):
|
|||||||
return new_class
|
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:
|
class MiddlewareMixin:
|
||||||
sync_capable = True
|
sync_capable = True
|
||||||
async_capable = True
|
async_capable = True
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from django.test import SimpleTestCase
|
from django.test import SimpleTestCase
|
||||||
from django.utils.deprecation import (
|
from django.utils.deprecation import RemovedAfterNextVersionWarning, RenameMethodsBase
|
||||||
DeprecationInstanceCheck,
|
|
||||||
RemovedAfterNextVersionWarning,
|
|
||||||
RemovedInNextVersionWarning,
|
|
||||||
RenameMethodsBase,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class RenameManagerMethods(RenameMethodsBase):
|
class RenameManagerMethods(RenameMethodsBase):
|
||||||
@ -166,14 +161,3 @@ class RenameMethodsTests(SimpleTestCase):
|
|||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
issubclass(RemovedAfterNextVersionWarning, PendingDeprecationWarning)
|
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)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user