Skip to content

Commit

Permalink
Drop unneccessary private import in tests (#2498)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchristie authored Dec 12, 2022
1 parent a8dd079 commit af56476
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions tests/models/test_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import pytest

import httpx
from httpx._compat import brotli


class StreamingBody:
Expand Down Expand Up @@ -863,31 +862,29 @@ def test_link_headers(headers, expected):
@pytest.mark.parametrize("header_value", (b"deflate", b"gzip", b"br"))
def test_decode_error_with_request(header_value):
headers = [(b"Content-Encoding", header_value)]
body = b"test 123"
compressed_body = brotli.compress(body)[3:]
broken_compressed_body = b"xxxxxxxxxxxxxx"
with pytest.raises(httpx.DecodingError):
httpx.Response(
200,
headers=headers,
content=compressed_body,
content=broken_compressed_body,
)

with pytest.raises(httpx.DecodingError):
httpx.Response(
200,
headers=headers,
content=compressed_body,
content=broken_compressed_body,
request=httpx.Request("GET", "https://www.example.org/"),
)


@pytest.mark.parametrize("header_value", (b"deflate", b"gzip", b"br"))
def test_value_error_without_request(header_value):
headers = [(b"Content-Encoding", header_value)]
body = b"test 123"
compressed_body = brotli.compress(body)[3:]
broken_compressed_body = b"xxxxxxxxxxxxxx"
with pytest.raises(httpx.DecodingError):
httpx.Response(200, headers=headers, content=compressed_body)
httpx.Response(200, headers=headers, content=broken_compressed_body)


def test_response_with_unset_request():
Expand Down

0 comments on commit af56476

Please sign in to comment.