1
0
mirror of https://github.com/django/django.git synced 2025-10-25 22:56:12 +00:00

Fixed #35518 -- Optimized RoutePattern by using string operations for converter-less routes.

This commit is contained in:
Jake Howard
2024-06-10 17:32:08 +01:00
committed by Sarah Boyce
parent f66c79e93d
commit f920937c8a
2 changed files with 25 additions and 11 deletions

View File

@@ -13,6 +13,12 @@ class RoutePatternTests(SimpleTestCase):
def test_str(self):
self.assertEqual(str(RoutePattern(_("translated/"))), "translated/")
def test_has_converters(self):
self.assertEqual(len(RoutePattern("translated/").converters), 0)
self.assertEqual(len(RoutePattern(_("translated/")).converters), 0)
self.assertEqual(len(RoutePattern("translated/<int:foo>").converters), 1)
self.assertEqual(len(RoutePattern(_("translated/<int:foo>")).converters), 1)
class ResolverCacheTests(SimpleTestCase):
@override_settings(ROOT_URLCONF="urlpatterns.path_urls")