Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop unneccessary private import in tests #2498

Merged
merged 2 commits into from
Dec 12, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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