assert response.elapsed > timedelta(seconds=0)
+@pytest.mark.parametrize(
+ "url",
+ [
+ pytest.param("invalid://example.org", id="scheme-not-http(s)"),
+ pytest.param("://example.org", id="no-scheme"),
+ pytest.param("http://", id="no-host"),
+ ],
+)
@pytest.mark.usefixtures("async_environment")
-async def test_get_invalid_url(server):
+async def test_get_invalid_url(server, url):
async with httpx.AsyncClient() as client:
with pytest.raises(httpx.InvalidURL):
- await client.get("invalid://example.org")
- with pytest.raises(httpx.InvalidURL):
- await client.get("://example.org")
- with pytest.raises(httpx.InvalidURL):
- await client.get("http://")
+ await client.get(url)
@pytest.mark.usefixtures("async_environment")
assert response.elapsed > timedelta(0)
-def test_get_invalid_url(server):
+@pytest.mark.parametrize(
+ "url",
+ [
+ pytest.param("invalid://example.org", id="scheme-not-http(s)"),
+ pytest.param("://example.org", id="no-scheme"),
+ pytest.param("http://", id="no-host"),
+ ],
+)
+def test_get_invalid_url(server, url):
with httpx.Client() as client:
with pytest.raises(httpx.InvalidURL):
- client.get("invalid://example.org")
- with pytest.raises(httpx.InvalidURL):
- client.get("://example.org")
- with pytest.raises(httpx.InvalidURL):
- client.get("http://")
+ client.get(url)
def test_build_request(server):