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

Function test_transport_for_request

tests/client/test_proxies.py:88–99  ·  tests/client/test_proxies.py::test_transport_for_request
(url, proxies, expected)

Source from the content-addressed store, hash-verified

86 ],
87)
88def test_transport_for_request(url, proxies, expected):
89 mounts = {key: httpx.HTTPTransport(proxy=value) for key, value in proxies.items()}
90 client = httpx.Client(mounts=mounts)
91
92 transport = client._transport_for_url(httpx.URL(url))
93
94 if expected is None:
95 assert transport is client._transport
96 else:
97 assert isinstance(transport, httpx.HTTPTransport)
98 assert isinstance(transport._pool, httpcore.HTTPProxy)
99 assert transport._pool._proxy_url == url_to_origin(expected)
100
101
102@pytest.mark.anyio

Callers

nothing calls this directly

Calls 3

_transport_for_urlMethod · 0.95
url_to_originFunction · 0.85
itemsMethod · 0.45

Tested by

no test coverage detected