]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Test deprecations
authorTom Christie <tom.christie@krakentechnologies.ltd>
Thu, 11 Jan 2024 15:24:26 +0000 (15:24 +0000)
committerTom Christie <tom.christie@krakentechnologies.ltd>
Thu, 11 Jan 2024 15:24:26 +0000 (15:24 +0000)
tests/client/test_async_client.py
tests/client/test_client.py

index c5bc177c92db7626f3b14f928d6df5f75e533968..d2bbfc2edd185d6a9914a3a85cc49c88e9f8c2e1 100644 (file)
@@ -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)
index ec8b449be7cf6e925a3825ca85a37622f0eadc56..c460fced50b00fc73a8fdabea2aa803c5e0461f6 100644 (file)
@@ -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)