MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / test_array_brackets

Function test_array_brackets

tests/test_qs.py:76–85  ·  view source on GitHub ↗
(method: str)

Source from the content-addressed store, hash-verified

74
75@pytest.mark.parametrize("method", ["class", "function"])
76def test_array_brackets(method: str) -> None:
77 if method == "class":
78 serialise = Querystring(array_format="brackets").stringify
79 else:
80 serialise = partial(stringify, array_format="brackets")
81
82 assert unquote(serialise({"in": ["foo", "bar"]})) == "in[]=foo&in[]=bar"
83 assert unquote(serialise({"a": {"b": [True, False]}})) == "a[b][]=true&a[b][]=false"
84 assert unquote(serialise({"a": {"b": [True, False, None, True]}})) == "a[b][]=true&a[b][]=false&a[b][]=true"
85 assert unquote(serialise({"in": ["", "foo"]})) == "in[]=&in[]=foo"
86
87
88def test_unknown_array_format() -> None:

Callers

nothing calls this directly

Calls 1

QuerystringClass · 0.90

Tested by

no test coverage detected