Skip to content

Commit 3ebaa83

Browse files
committed
Format code with ruff
1 parent 6e888bc commit 3ebaa83

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

httpx/_urls.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ def __init__(self, url: URL | str = "", **kwargs: typing.Any) -> None:
119119
# Get existing query params from the URL
120120
if isinstance(url, str):
121121
parsed_url = urlparse(url)
122-
existing_params = QueryParams(parsed_url.query) if parsed_url.query else QueryParams()
122+
existing_params = (
123+
QueryParams(parsed_url.query)
124+
if parsed_url.query
125+
else QueryParams()
126+
)
123127
elif isinstance(url, URL):
124128
existing_params = url.params
125129
else:

tests/models/test_url.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,9 @@ def test_url_params_merge_with_existing_query():
871871
Regression test for issue #3621.
872872
"""
873873
# URL with existing query params + additional params argument
874-
url = httpx.URL("https://example.com/get?page=post&s=list", params={"pid": 0, "tags": "test"})
874+
url = httpx.URL(
875+
"https://example.com/get?page=post&s=list", params={"pid": 0, "tags": "test"}
876+
)
875877

876878
assert url.path == "/get"
877879
assert "page=post" in str(url)
@@ -889,7 +891,9 @@ def test_url_params_override_with_same_key():
889891
Test that when a URL has existing query params and new params with
890892
the same key are provided, the new params override the old ones.
891893
"""
892-
url = httpx.URL("https://example.com/get?a=old&b=keep", params={"a": "new", "c": "add"})
894+
url = httpx.URL(
895+
"https://example.com/get?a=old&b=keep", params={"a": "new", "c": "add"}
896+
)
893897

894898
params = dict(url.params)
895899
assert params["a"] == "new" # Overridden

0 commit comments

Comments
 (0)