"POST", "http://127.0.0.1:8000/", content=hello_world()
)
assert response.status_code == 200
+
+
+@pytest.mark.asyncio
+async def test_raise_for_status(server):
+ async with httpcore.Client() as client:
+ for status_code in (200, 400, 404, 500, 505):
+ response = await client.request(
+ "GET", f"http://127.0.0.1:8000/status/{status_code}"
+ )
+
+ if 400 <= status_code < 600:
+ with pytest.raises(httpcore.exceptions.HttpError):
+ response.raise_for_status()
+ else:
+ assert response.raise_for_status() is None