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

Function test_build_values_dict

tests/test_routing.py:870–885  ·  view source on GitHub ↗
(endpoint, value, expect)

Source from the content-addressed store, hash-verified

868 ],
869)
870def test_build_values_dict(endpoint, value, expect):
871 class ListConverter(r.BaseConverter):
872 def to_url(self, value: t.Any) -> str:
873 return super().to_url(".".join(map(str, value)))
874
875 url_map = r.Map(
876 [r.Rule("/<int:v>", endpoint="int"), r.Rule("/<list:v>", endpoint="list")],
877 converters={"list": ListConverter},
878 )
879 adapter = url_map.bind("localhost")
880
881 if isinstance(expect, str):
882 assert adapter.build(endpoint, {"v": value}) == expect
883 else:
884 with pytest.raises(expect):
885 adapter.build(endpoint, {"v": value})
886
887
888@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 2

bindMethod · 0.95
buildMethod · 0.45

Tested by

no test coverage detected