summaryrefslogtreecommitdiff
path: root/tests/urlpatterns
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2024-02-26 10:41:15 +0000
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2024-03-05 13:09:10 +0100
commiteff21d8e7a1cb297aedf1c702668b590a1b618f3 (patch)
treec9f25114db9f3ee3373690d32e30aec9bceddd03 /tests/urlpatterns
parent241adf678f8d6f0d6ec62d0bed5e32611a3fb75c (diff)
Fixed #35252 -- Optimized _route_to_regex().
co-authored-by: Nick Pope <nick@nickpope.me.uk>
Diffstat (limited to 'tests/urlpatterns')
-rw-r--r--tests/urlpatterns/tests.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/urlpatterns/tests.py b/tests/urlpatterns/tests.py
index 370e869560..78b71fe325 100644
--- a/tests/urlpatterns/tests.py
+++ b/tests/urlpatterns/tests.py
@@ -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)