MCPcopy
hub / github.com/encode/httpx / test_multipart_invalid_key

Function test_multipart_invalid_key

tests/test_multipart.py:98–110  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

96
97@pytest.mark.parametrize(("key"), (b"abc", 1, 2.3, None))
98def test_multipart_invalid_key(key):
99 client = httpx.Client(transport=httpx.MockTransport(echo_request_content))
100
101 data = {key: "abc"}
102 files = {"file": io.BytesIO(b"<file content>")}
103 with pytest.raises(TypeError) as e:
104 client.post(
105 "http://127.0.0.1:8000/",
106 data=data,
107 files=files,
108 )
109 assert "Invalid type for name" in str(e.value)
110 assert repr(key) in str(e.value)
111
112
113@pytest.mark.parametrize(("value"), (object(), {"key": "value"}))

Callers

nothing calls this directly

Calls 1

postMethod · 0.95

Tested by

no test coverage detected