MCPcopy
hub / github.com/django/django / test_whitespace_in_route

Method test_whitespace_in_route

tests/urlpatterns/tests.py:232–242  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

230 path("foo", EmptyCBV())
231
232 def test_whitespace_in_route(self):
233 msg = "URL route %r cannot contain whitespace in angle brackets <…>"
234 for whitespace in string.whitespace:
235 with self.subTest(repr(whitespace)):
236 route = "space/<int:num>/extra/<str:%stest>" % whitespace
237 with self.assertRaisesMessage(ImproperlyConfigured, msg % route):
238 path(route, empty_view)
239 # Whitespaces are valid in paths.
240 p = path("space%s/<int:num>/" % string.whitespace, empty_view)
241 match = p.resolve("space%s/1/" % string.whitespace)
242 self.assertEqual(match.kwargs, {"num": 1})
243
244 def test_path_trailing_newlines(self):
245 tests = [

Callers

nothing calls this directly

Calls 2

assertRaisesMessageMethod · 0.80
resolveMethod · 0.45

Tested by

no test coverage detected