MCPcopy
hub / github.com/pallets/werkzeug / test_greedy

Function test_greedy

tests/test_routing.py:382–398  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

380
381
382def test_greedy():
383 map = r.Map(
384 [
385 r.Rule("/foo", endpoint="foo"),
386 r.Rule("/<path:bar>", endpoint="bar"),
387 r.Rule("/<path:bar>/<path:blub>", endpoint="bar"),
388 ]
389 )
390 adapter = map.bind("example.org", "/")
391
392 assert adapter.match("/foo") == ("foo", {})
393 assert adapter.match("/blub") == ("bar", {"bar": "blub"})
394 assert adapter.match("/he/he") == ("bar", {"bar": "he", "blub": "he"})
395
396 assert adapter.build("foo", {}) == "/foo"
397 assert adapter.build("bar", {"bar": "blub"}) == "/blub"
398 assert adapter.build("bar", {"bar": "blub", "blub": "bar"}) == "/blub/bar"
399
400
401def test_path():

Callers

nothing calls this directly

Calls 3

bindMethod · 0.95
matchMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected