mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #35252 -- Optimized _route_to_regex().
co-authored-by: Nick Pope <nick@nickpope.me.uk>
This commit is contained in:
committed by
Mariusz Felisiak
parent
241adf678f
commit
eff21d8e7a
@@ -246,14 +246,12 @@ class SimplifiedURLTests(SimpleTestCase):
|
||||
path("foo", EmptyCBV())
|
||||
|
||||
def test_whitespace_in_route(self):
|
||||
msg = (
|
||||
"URL route 'space/<int:num>/extra/<str:%stest>' cannot contain "
|
||||
"whitespace in angle brackets <…>"
|
||||
)
|
||||
msg = "URL route %r cannot contain whitespace in angle brackets <…>"
|
||||
for whitespace in string.whitespace:
|
||||
with self.subTest(repr(whitespace)):
|
||||
with self.assertRaisesMessage(ImproperlyConfigured, msg % whitespace):
|
||||
path("space/<int:num>/extra/<str:%stest>" % whitespace, empty_view)
|
||||
route = "space/<int:num>/extra/<str:%stest>" % whitespace
|
||||
with self.assertRaisesMessage(ImproperlyConfigured, msg % route):
|
||||
path(route, empty_view)
|
||||
# Whitespaces are valid in paths.
|
||||
p = path("space%s/<int:num>/" % string.whitespace, empty_view)
|
||||
match = p.resolve("space%s/1/" % string.whitespace)
|
||||
|
||||
Reference in New Issue
Block a user