(server)
| 113 | |
| 114 | @pytest.mark.anyio |
| 115 | async def test_raise_for_status(server): |
| 116 | async with httpx.AsyncClient() as client: |
| 117 | for status_code in (200, 400, 404, 500, 505): |
| 118 | response = await client.request( |
| 119 | "GET", server.url.copy_with(path=f"/status/{status_code}") |
| 120 | ) |
| 121 | |
| 122 | if 400 <= status_code < 600: |
| 123 | with pytest.raises(httpx.HTTPStatusError) as exc_info: |
| 124 | response.raise_for_status() |
| 125 | assert exc_info.value.response == response |
| 126 | else: |
| 127 | assert response.raise_for_status() is response |
| 128 | |
| 129 | |
| 130 | @pytest.mark.anyio |
nothing calls this directly
no test coverage detected