From 927b5ac58942eb0f6dfdc3e0b90cac0d3bc9ae8e Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 3 Sep 2025 09:53:26 +0200 Subject: [PATCH] Upgrade Python formatter ruff --- httpx/_exceptions.py | 4 +--- httpx/_urls.py | 2 +- requirements.txt | 2 +- tests/test_content.py | 12 ++++++------ 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/httpx/_exceptions.py b/httpx/_exceptions.py index 77f45a6d39..dd7fb6cdb3 100644 --- a/httpx/_exceptions.py +++ b/httpx/_exceptions.py @@ -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) diff --git a/httpx/_urls.py b/httpx/_urls.py index 147a8fa333..301d0874d5 100644 --- a/httpx/_urls.py +++ b/httpx/_urls.py @@ -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( [ diff --git a/requirements.txt b/requirements.txt index 646cb813d7..8b5a111a71 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/tests/test_content.py b/tests/test_content.py index f63ec18a6b..9bfe983722 100644 --- a/tests/test_content.py +++ b/tests/test_content.py @@ -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"