From e559070a7a1aa70eaf97686da6e8116c3c7b08fd Mon Sep 17 00:00:00 2001 From: saeedblanchette Date: Fri, 18 Feb 2022 21:22:50 +0100 Subject: [PATCH] Fixed #33518 -- Added RemovedAfterNextVersionWarning. --- django/utils/deprecation.py | 3 +++ tests/deprecation/tests.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/django/utils/deprecation.py b/django/utils/deprecation.py index 528783a5c1..325dade182 100644 --- a/django/utils/deprecation.py +++ b/django/utils/deprecation.py @@ -13,6 +13,9 @@ class RemovedInDjango50Warning(PendingDeprecationWarning): pass +RemovedAfterNextVersionWarning = RemovedInDjango50Warning + + class warn_about_renamed_method: def __init__( self, class_name, old_method_name, new_method_name, deprecation_warning diff --git a/tests/deprecation/tests.py b/tests/deprecation/tests.py index eae217bfb3..b64691eb55 100644 --- a/tests/deprecation/tests.py +++ b/tests/deprecation/tests.py @@ -3,6 +3,7 @@ import warnings from django.test import SimpleTestCase from django.utils.deprecation import ( DeprecationInstanceCheck, + RemovedAfterNextVersionWarning, RemovedInNextVersionWarning, RenameMethodsBase, ) @@ -161,6 +162,11 @@ class RenameMethodsTests(SimpleTestCase): with self.assertWarnsMessage(DeprecationWarning, msg): deprecated.old() + def test_removedafternextversionwarning_pending(self): + self.assertTrue( + issubclass(RemovedAfterNextVersionWarning, PendingDeprecationWarning) + ) + class DeprecationInstanceCheckTest(SimpleTestCase): def test_warning(self):