Skip to content

Commit

Permalink
Refs #35090 -- Fixed urlpatterns.tests.SimplifiedURLTests when run in…
Browse files Browse the repository at this point in the history
… reverse.
  • Loading branch information
felixxm authored Feb 29, 2024
1 parent 11695b8 commit 0e84e70
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions tests/urlpatterns/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
resolve,
reverse,
)
from django.urls.converters import IntConverter
from django.urls.converters import REGISTERED_CONVERTERS, IntConverter
from django.utils.deprecation import RemovedInDjango60Warning
from django.views import View

Expand Down Expand Up @@ -211,8 +211,11 @@ def test_warning_override_default_converter(self):
"Converter 'int' is already registered. Support for overriding registered "
"converters is deprecated and will be removed in Django 6.0."
)
with self.assertWarnsMessage(RemovedInDjango60Warning, msg):
register_converter(IntConverter, "int")
try:
with self.assertWarnsMessage(RemovedInDjango60Warning, msg):
register_converter(IntConverter, "int")
finally:
REGISTERED_CONVERTERS.pop("int", None)

def test_warning_override_converter(self):
# RemovedInDjango60Warning: when the deprecation ends, replace with
Expand All @@ -222,8 +225,12 @@ def test_warning_override_converter(self):
"Converter 'base64' is already registered. Support for overriding "
"registered converters is deprecated and will be removed in Django 6.0."
)
with self.assertWarnsMessage(RemovedInDjango60Warning, msg):
register_converter(Base64Converter, "base64")
try:
with self.assertWarnsMessage(RemovedInDjango60Warning, msg):
register_converter(Base64Converter, "base64")
register_converter(Base64Converter, "base64")
finally:
REGISTERED_CONVERTERS.pop("base64", None)

def test_invalid_view(self):
msg = "view must be a callable or a list/tuple in the case of include()."
Expand Down

0 comments on commit 0e84e70

Please sign in to comment.