summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTAHRI Ahmed R <Ousret@users.noreply.github.com>2023-03-31 17:28:20 +0200
committerGitHub <noreply@github.com>2023-03-31 10:28:20 -0500
commit85d71221a5eb3ce561c73b9619afc0a37d3d11ed (patch)
tree46d643e2872c7da4977e3ca3181b364461f9d5ac /test
parent969fdb9545caeb4e8141ea939231cf03a2db606f (diff)
downloadurllib3-85d71221a5eb3ce561c73b9619afc0a37d3d11ed.tar.gz
Fixed coverage regression when zstd >= 0.20 is installed
Diffstat (limited to 'test')
-rw-r--r--test/test_response.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test_response.py b/test/test_response.py
index 25cc7a99..1a296b68 100644
--- a/test/test_response.py
+++ b/test/test_response.py
@@ -354,6 +354,15 @@ class TestResponse:
with pytest.raises(DecodeError):
HTTPResponse(fp, headers={"content-encoding": "zstd"})
+ @onlyZstd()
+ @pytest.mark.parametrize("data", [b"foo", b"x" * 100])
+ def test_decode_zstd_incomplete(self, data: bytes) -> None:
+ data = zstd.compress(data)
+ fp = BytesIO(data[:-1])
+
+ with pytest.raises(DecodeError):
+ HTTPResponse(fp, headers={"content-encoding": "zstd"})
+
def test_multi_decoding_deflate_deflate(self) -> None:
data = zlib.compress(zlib.compress(b"foo"))