summaryrefslogtreecommitdiff
path: root/tests/deprecation
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-09-26 13:38:04 -0400
committerTim Graham <timograham@gmail.com>2015-09-29 18:31:11 -0400
commit8d1a001ef6dcbbe8053da05cdb3ec99965b0953f (patch)
tree707290d6af039eb825af8e93b3aa19df88d4e43e /tests/deprecation
parentae9f9dc37f39afeaa45c646cf6eef81beffcf021 (diff)
downloaddjango-8d1a001ef6dcbbe8053da05cdb3ec99965b0953f.tar.gz
Fixed #25466 -- Added backwards compatibility aliases for LoaderOrigin and StringOrigin.
Thanks Simon Charette for the DeprecationInstanceCheck class.
Diffstat (limited to 'tests/deprecation')
-rw-r--r--tests/deprecation/tests.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/deprecation/tests.py b/tests/deprecation/tests.py
index e1ff2c8d2c..f50b2b624d 100644
--- a/tests/deprecation/tests.py
+++ b/tests/deprecation/tests.py
@@ -5,7 +5,9 @@ import warnings
from django.test import SimpleTestCase
from django.test.utils import reset_warning_registry
from django.utils import six
-from django.utils.deprecation import RenameMethodsBase
+from django.utils.deprecation import (
+ DeprecationInstanceCheck, RemovedInNextVersionWarning, RenameMethodsBase,
+)
class RenameManagerMethods(RenameMethodsBase):
@@ -170,3 +172,16 @@ class RenameMethodsTests(SimpleTestCase):
'`DeprecatedMixin.old` is deprecated, use `new` instead.',
'`RenamedMixin.old` is deprecated, use `new` instead.',
])
+
+
+class DeprecationInstanceCheckTest(SimpleTestCase):
+ def test_warning(self):
+ class Manager(six.with_metaclass(DeprecationInstanceCheck)):
+ alternative = 'fake.path.Foo'
+ deprecation_warning = RemovedInNextVersionWarning
+
+ msg = '`Manager` is deprecated, use `fake.path.Foo` instead.'
+ with warnings.catch_warnings():
+ warnings.simplefilter('error', category=RemovedInNextVersionWarning)
+ with self.assertRaisesMessage(RemovedInNextVersionWarning, msg):
+ isinstance(object, Manager)