MCPcopy
hub / github.com/encode/starlette / test_url_path_for

Function test_url_path_for

tests/test_routing.py:261–272  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

259
260
261def test_url_path_for() -> None:
262 assert app.url_path_for("homepage") == "/"
263 assert app.url_path_for("user", username="tomchristie") == "/users/tomchristie"
264 assert app.url_path_for("websocket_endpoint") == "/ws"
265 with pytest.raises(NoMatchFound, match='No route exists for name "broken" and params "".'):
266 assert app.url_path_for("broken")
267 with pytest.raises(NoMatchFound, match='No route exists for name "broken" and params "key, key2".'):
268 assert app.url_path_for("broken", key="value", key2="value2")
269 with pytest.raises(AssertionError):
270 app.url_path_for("user", username="tom/christie")
271 with pytest.raises(AssertionError):
272 app.url_path_for("user", username="")
273
274
275def test_url_for() -> None:

Callers

nothing calls this directly

Calls 1

url_path_forMethod · 0.45

Tested by

no test coverage detected