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

Function test_defaults

tests/test_routing.py:342–356  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

340
341
342def test_defaults():
343 map = r.Map(
344 [
345 r.Rule("/foo/", defaults={"page": 1}, endpoint="foo"),
346 r.Rule("/foo/<int:page>", endpoint="foo"),
347 ]
348 )
349 adapter = map.bind("example.org", "/")
350
351 assert adapter.match("/foo/") == ("foo", {"page": 1})
352 pytest.raises(r.RequestRedirect, lambda: adapter.match("/foo/1"))
353 assert adapter.match("/foo/2") == ("foo", {"page": 2})
354 assert adapter.build("foo", {}) == "/foo/"
355 assert adapter.build("foo", {"page": 1}) == "/foo/"
356 assert adapter.build("foo", {"page": 2}) == "/foo/2"
357
358
359def test_negative():

Callers

nothing calls this directly

Calls 3

bindMethod · 0.95
matchMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…