Skip to content

Commit 918fb49

Browse files
cubehouseclaude
andcommitted
style: apply ruff format
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6690159 commit 918fb49

20 files changed

Lines changed: 74 additions & 126 deletions

scripts/regenerate.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
spec marks ``nullable: true`` but which ``datamodel-code-generator`` leaves as
55
required non-Optional. See the plan entry for Task 7 and GitHub issues #1/#2.
66
"""
7+
78
from __future__ import annotations
89

910
import re

tests/unit/test_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def _handler(counter, body):
88
def h(req):
99
counter["n"] += 1
1010
return httpx.Response(200, json=body)
11+
1112
return h
1213

1314

tests/unit/test_client_async.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ def h(req):
1414
async def test_async_raw_works_through_context_manager():
1515
counter = {"n": 0}
1616
body = {"destinations": []}
17-
async with AsyncThemeParks(
18-
transport=httpx.MockTransport(_handler(counter, body))
19-
) as tp:
17+
async with AsyncThemeParks(transport=httpx.MockTransport(_handler(counter, body))) as tp:
2018
res = await tp.raw.get_destinations()
2119
assert res.destinations == []
2220
assert counter["n"] == 1
@@ -43,9 +41,7 @@ async def test_async_cache_bypasses_live():
4341
async def test_async_cache_false_disables():
4442
counter = {"n": 0}
4543
body = {"destinations": []}
46-
tp = AsyncThemeParks(
47-
transport=httpx.MockTransport(_handler(counter, body)), cache=False
48-
)
44+
tp = AsyncThemeParks(transport=httpx.MockTransport(_handler(counter, body)), cache=False)
4945
await tp.raw.get_destinations()
5046
await tp.raw.get_destinations()
5147
assert counter["n"] == 2

tests/unit/test_entity.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ def test_walk_bfs_and_dedupes():
4848
},
4949
{"id": "c", "children": []},
5050
]
51-
tp = ThemeParks(
52-
transport=httpx.MockTransport(sequential_handler(responses)), cache=False
53-
)
51+
tp = ThemeParks(transport=httpx.MockTransport(sequential_handler(responses)), cache=False)
5452
ids = [c.id for c in tp.entity("root").walk()]
5553
assert ids == ["a", "b", "c"]
5654

tests/unit/test_entity_async.py

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ async def test_async_walk_bfs_and_dedupes():
7171
},
7272
{"id": "c", "children": []},
7373
]
74-
tp = AsyncThemeParks(
75-
transport=httpx.MockTransport(sequential_handler(responses)), cache=False
76-
)
74+
tp = AsyncThemeParks(transport=httpx.MockTransport(sequential_handler(responses)), cache=False)
7775
ids = [c.id async for c in tp.entity("root").walk()]
7876
assert ids == ["a", "b", "c"]
7977

@@ -83,9 +81,7 @@ async def test_async_schedule_month():
8381
transport=httpx.MockTransport(
8482
by_path(
8583
{
86-
"/v1/entity/abc/schedule/2026/4": {
87-
"schedule": [_entry("2026-04-01")]
88-
},
84+
"/v1/entity/abc/schedule/2026/4": {"schedule": [_entry("2026-04-01")]},
8985
}
9086
)
9187
),
@@ -100,23 +96,15 @@ async def test_async_schedule_range_fanout_and_sort():
10096
transport=httpx.MockTransport(
10197
by_path(
10298
{
103-
"/v1/entity/abc/schedule/2026/3": {
104-
"schedule": [_entry("2026-03-31")]
105-
},
106-
"/v1/entity/abc/schedule/2026/4": {
107-
"schedule": [_entry("2026-04-15")]
108-
},
109-
"/v1/entity/abc/schedule/2026/5": {
110-
"schedule": [_entry("2026-05-01")]
111-
},
99+
"/v1/entity/abc/schedule/2026/3": {"schedule": [_entry("2026-03-31")]},
100+
"/v1/entity/abc/schedule/2026/4": {"schedule": [_entry("2026-04-15")]},
101+
"/v1/entity/abc/schedule/2026/5": {"schedule": [_entry("2026-05-01")]},
112102
}
113103
)
114104
),
115105
cache=False,
116106
)
117-
entries = await tp.entity("abc").schedule.range(
118-
date(2026, 3, 20), date(2026, 5, 10)
119-
)
107+
entries = await tp.entity("abc").schedule.range(date(2026, 3, 20), date(2026, 5, 10))
120108
assert [e.date for e in entries] == ["2026-03-31", "2026-04-15", "2026-05-01"]
121109

122110

@@ -165,13 +153,9 @@ async def handler_inner(req: httpx.Request) -> httpx.Response:
165153
},
166154
)
167155
# Leaves: empty children list
168-
return httpx.Response(
169-
200, json={"id": path.rsplit("/", 2)[1], "children": []}
170-
)
156+
return httpx.Response(200, json={"id": path.rsplit("/", 2)[1], "children": []})
171157

172-
tp = AsyncThemeParks(
173-
transport=httpx.MockTransport(handler_inner), cache=False
174-
)
158+
tp = AsyncThemeParks(transport=httpx.MockTransport(handler_inner), cache=False)
175159
start = time.monotonic()
176160
ids = [c.id async for c in tp.entity("root").walk()]
177161
elapsed = time.monotonic() - start
@@ -216,13 +200,9 @@ async def handler_inner(req: httpx.Request) -> httpx.Response:
216200
],
217201
},
218202
)
219-
return httpx.Response(
220-
200, json={"id": path.rsplit("/", 2)[1], "children": []}
221-
)
203+
return httpx.Response(200, json={"id": path.rsplit("/", 2)[1], "children": []})
222204

223-
tp = AsyncThemeParks(
224-
transport=httpx.MockTransport(handler_inner), cache=False
225-
)
205+
tp = AsyncThemeParks(transport=httpx.MockTransport(handler_inner), cache=False)
226206
ids = [c.id async for c in tp.entity("root").walk(concurrency=2)]
227207
assert len(ids) == 10
228208
assert peak_in_flight <= 2

tests/unit/test_errors.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ def test_api_error_carries_status_body_url():
2424

2525

2626
def test_rate_limit_error_extends_api_error():
27-
e = RateLimitError(
28-
"rate limited", status=429, body=None, url="/x", retry_after=1.5
29-
)
27+
e = RateLimitError("rate limited", status=429, body=None, url="/x", retry_after=1.5)
3028
assert isinstance(e, APIError)
3129
assert e.retry_after == 1.5
3230

@@ -50,9 +48,7 @@ def test_api_error_repr_includes_status_and_url():
5048

5149

5250
def test_rate_limit_error_repr_includes_retry_after():
53-
e = RateLimitError(
54-
"rate limited", status=429, body=None, url="/x", retry_after=5.0
55-
)
51+
e = RateLimitError("rate limited", status=429, body=None, url="/x", retry_after=5.0)
5652
assert repr(e) == "RateLimitError(status=429, url='/x', retry_after=5.0)"
5753

5854

tests/unit/test_generated.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
If datamodel-codegen output ever drifts and silently breaks the post-gen
44
patches, these assertions fail loudly in CI.
55
"""
6+
67
from themeparks._generated.models import LiveQueue
78

89

tests/unit/test_raw.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for the low-level raw client."""
2+
23
from __future__ import annotations
34

45
import json
@@ -20,9 +21,7 @@ def make_raw(body) -> RawClient:
2021
def handler(req: httpx.Request) -> httpx.Response:
2122
return httpx.Response(200, json=body)
2223

23-
client = httpx.Client(
24-
transport=httpx.MockTransport(handler), base_url="https://x/v1"
25-
)
24+
client = httpx.Client(transport=httpx.MockTransport(handler), base_url="https://x/v1")
2625
t = SyncTransport(
2726
client=client,
2827
base_url="https://x/v1",
@@ -59,9 +58,7 @@ def handler(req: httpx.Request) -> httpx.Response:
5958
captured["url"] = req.url.path
6059
return httpx.Response(200, json={"schedule": []})
6160

62-
client = httpx.Client(
63-
transport=httpx.MockTransport(handler), base_url="https://x/v1"
64-
)
61+
client = httpx.Client(transport=httpx.MockTransport(handler), base_url="https://x/v1")
6562
t = SyncTransport(
6663
client=client,
6764
base_url="https://x/v1",

tests/unit/test_raw_async.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for the async low-level raw client."""
2+
23
from __future__ import annotations
34

45
import json
@@ -24,9 +25,7 @@ def make_async_raw(body) -> AsyncRawClient:
2425
def handler(req: httpx.Request) -> httpx.Response:
2526
return httpx.Response(200, json=body)
2627

27-
client = httpx.AsyncClient(
28-
transport=httpx.MockTransport(handler), base_url="https://x/v1"
29-
)
28+
client = httpx.AsyncClient(transport=httpx.MockTransport(handler), base_url="https://x/v1")
3029
t = AsyncTransport(
3130
client=client,
3231
base_url="https://x/v1",
@@ -56,9 +55,7 @@ def handler(req: httpx.Request) -> httpx.Response:
5655
captured["url"] = req.url.path
5756
return httpx.Response(200, json={"schedule": []})
5857

59-
client = httpx.AsyncClient(
60-
transport=httpx.MockTransport(handler), base_url="https://x/v1"
61-
)
58+
client = httpx.AsyncClient(transport=httpx.MockTransport(handler), base_url="https://x/v1")
6259
t = AsyncTransport(
6360
client=client,
6461
base_url="https://x/v1",

tests/unit/test_schedule.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ def test_schedule_month():
2929
transport=httpx.MockTransport(
3030
by_path(
3131
{
32-
"/v1/entity/abc/schedule/2026/4": {
33-
"schedule": [_entry("2026-04-01")]
34-
},
32+
"/v1/entity/abc/schedule/2026/4": {"schedule": [_entry("2026-04-01")]},
3533
}
3634
)
3735
),
@@ -46,15 +44,9 @@ def test_schedule_range_fanout_and_sort():
4644
transport=httpx.MockTransport(
4745
by_path(
4846
{
49-
"/v1/entity/abc/schedule/2026/3": {
50-
"schedule": [_entry("2026-03-31")]
51-
},
52-
"/v1/entity/abc/schedule/2026/4": {
53-
"schedule": [_entry("2026-04-15")]
54-
},
55-
"/v1/entity/abc/schedule/2026/5": {
56-
"schedule": [_entry("2026-05-01")]
57-
},
47+
"/v1/entity/abc/schedule/2026/3": {"schedule": [_entry("2026-03-31")]},
48+
"/v1/entity/abc/schedule/2026/4": {"schedule": [_entry("2026-04-15")]},
49+
"/v1/entity/abc/schedule/2026/5": {"schedule": [_entry("2026-05-01")]},
5850
}
5951
)
6052
),
@@ -77,12 +69,8 @@ def test_schedule_range_crosses_year_boundary():
7769
transport=httpx.MockTransport(
7870
by_path(
7971
{
80-
"/v1/entity/abc/schedule/2026/12": {
81-
"schedule": [_entry("2026-12-31")]
82-
},
83-
"/v1/entity/abc/schedule/2027/1": {
84-
"schedule": [_entry("2027-01-02")]
85-
},
72+
"/v1/entity/abc/schedule/2026/12": {"schedule": [_entry("2026-12-31")]},
73+
"/v1/entity/abc/schedule/2027/1": {"schedule": [_entry("2027-01-02")]},
8674
}
8775
)
8876
),

0 commit comments

Comments
 (0)