summaryrefslogtreecommitdiff
path: root/test/test_response.py
diff options
context:
space:
mode:
authorQuentin Pradet <quentin.pradet@gmail.com>2022-11-17 17:43:26 +0400
committerGitHub <noreply@github.com>2022-11-17 07:43:26 -0600
commit19582a1f35ae810f97dc46897232770c810c197a (patch)
tree366d1e9579679b3522acc4353ba811ba49881ab6 /test/test_response.py
parent02e62247fde7bff4729bd6495ca4b5fe0fe1c239 (diff)
downloadurllib3-19582a1f35ae810f97dc46897232770c810c197a.tar.gz
Restore but deprecate HTTPResponse.getheaders() and .getheader() methods
Diffstat (limited to 'test/test_response.py')
-rw-r--r--test/test_response.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/test_response.py b/test/test_response.py
index 38218f40..e7ffe889 100644
--- a/test/test_response.py
+++ b/test/test_response.py
@@ -112,12 +112,20 @@ class TestLegacyResponse:
def test_getheaders(self) -> None:
headers = {"host": "example.com"}
r = HTTPResponse(headers=headers)
- assert r.getheaders() == [("host", "example.com")]
+ with pytest.warns(
+ DeprecationWarning,
+ match=r"HTTPResponse.getheaders\(\) is deprecated",
+ ):
+ assert r.getheaders() == [("host", "example.com")]
def test_getheader(self) -> None:
headers = {"host": "example.com"}
r = HTTPResponse(headers=headers)
- assert r.getheader("host") == "example.com"
+ with pytest.warns(
+ DeprecationWarning,
+ match=r"HTTPResponse.getheader\(\) is deprecated",
+ ):
+ assert r.getheader("host") == "example.com"
class TestResponse: