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

Function test_raise_for_status

tests/client/test_client.py:134–146  ·  view source on GitHub ↗
(server)

Source from the content-addressed store, hash-verified

132
133
134def test_raise_for_status(server):
135 with httpx.Client() as client:
136 for status_code in (200, 400, 404, 500, 505):
137 response = client.request(
138 "GET", server.url.copy_with(path=f"/status/{status_code}")
139 )
140 if 400 <= status_code < 600:
141 with pytest.raises(httpx.HTTPStatusError) as exc_info:
142 response.raise_for_status()
143 assert exc_info.value.response == response
144 assert exc_info.value.request.url.path == f"/status/{status_code}"
145 else:
146 assert response.raise_for_status() is response
147
148
149def test_options(server):

Callers

nothing calls this directly

Calls 3

raise_for_statusMethod · 0.80
requestMethod · 0.45
copy_withMethod · 0.45

Tested by

no test coverage detected