From: Tom Christie Date: Thu, 11 Jan 2024 15:24:26 +0000 (+0000) Subject: Test deprecations X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13483d1567ed9ad94b61ff17fe7dc08033a464a8;p=thirdparty%2Fhttpx.git Test deprecations --- diff --git a/tests/client/test_async_client.py b/tests/client/test_async_client.py index c5bc177c..d2bbfc2e 100644 --- a/tests/client/test_async_client.py +++ b/tests/client/test_async_client.py @@ -373,3 +373,9 @@ async def test_server_extensions(server): response = await client.get(url) assert response.status_code == 200 assert response.extensions["http_version"] == b"HTTP/1.1" + + +def test_http2_parameter_deprecated(): + # The 'http1' and 'http2' flags are deprecated in favor of `version=httpx.Version(...)`. + with pytest.raises(RuntimeError): + httpx.AsyncClient(http2=True) diff --git a/tests/client/test_client.py b/tests/client/test_client.py index ec8b449b..c460fced 100644 --- a/tests/client/test_client.py +++ b/tests/client/test_client.py @@ -460,3 +460,9 @@ def test_client_decode_text_using_explicit_encoding(): assert response.reason_phrase == "OK" assert response.encoding == "ISO-8859-1" assert response.text == text + + +def test_http2_parameter_deprecated(): + # The 'http1' and 'http2' flags are deprecated in favor of `version=httpx.Version(...)`. + with pytest.raises(RuntimeError): + httpx.Client(http2=True)