Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 1 addition & 3 deletions httpx/_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,7 @@ class StreamClosed(StreamError):
"""

def __init__(self) -> None:
message = (
"Attempted to read or stream content, but the stream has " "been closed."
)
message = "Attempted to read or stream content, but the stream has been closed."
super().__init__(message)


Expand Down
2 changes: 1 addition & 1 deletion httpx/_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def __repr__(self) -> str:

if ":" in userinfo:
# Mask any password component.
userinfo = f'{userinfo.split(":")[0]}:[secure]'
userinfo = f"{userinfo.split(':')[0]}:[secure]"

authority = "".join(
[
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ coverage[toml]==7.6.1
cryptography==44.0.1
mypy==1.13.0
pytest==8.3.4
ruff==0.8.1
ruff==0.12.11
trio==0.27.0
trio-typing==0.10.0
trustme==1.2.0
Expand Down
12 changes: 6 additions & 6 deletions tests/test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,18 +489,18 @@ def test_response_invalid_argument():
def test_ensure_ascii_false_with_french_characters():
data = {"greeting": "Bonjour, ça va ?"}
response = httpx.Response(200, json=data)
assert (
"ça va" in response.text
), "ensure_ascii=False should preserve French accented characters"
assert "ça va" in response.text, (
"ensure_ascii=False should preserve French accented characters"
)
assert response.headers["Content-Type"] == "application/json"


def test_separators_for_compact_json():
data = {"clé": "valeur", "liste": [1, 2, 3]}
response = httpx.Response(200, json=data)
assert (
response.text == '{"clé":"valeur","liste":[1,2,3]}'
), "separators=(',', ':') should produce a compact representation"
assert response.text == '{"clé":"valeur","liste":[1,2,3]}', (
"separators=(',', ':') should produce a compact representation"
)
assert response.headers["Content-Type"] == "application/json"


Expand Down