Skip to content

Commit 83b833f

Browse files
fsecada01claude
andcommitted
style: apply ruff format to SSE test files
CI was failing on ruff format --check. These 3 files were lint-clean but not formatter-clean. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d77f588 commit 83b833f

3 files changed

Lines changed: 9 additions & 10 deletions

File tree

tests/test_fastapi_sse.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ def test_stream_yields_multiple_frames(self, client):
8484
"/components/stream_counter/stream",
8585
json={"event": "count_up", "payload": {"steps": 3}},
8686
)
87-
lines = [
88-
ln for ln in response.text.strip().split("\n") if ln.startswith("data: ")
89-
]
87+
lines = [ln for ln in response.text.strip().split("\n") if ln.startswith("data: ")]
9088
assert len(lines) == 4 # 3 intermediate + 1 final
9189
frames = [json.loads(ln.removeprefix("data: ")) for ln in lines]
9290
assert frames[-1]["stream_done"] is True

tests/test_litestar_sse.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ def test_stream_yields_multiple_frames(self, client):
8484
"/components/stream_counter/stream",
8585
json={"event": "count_up", "payload": {"steps": 3}},
8686
)
87-
lines = [
88-
ln for ln in response.text.strip().split("\n") if ln.startswith("data: ")
89-
]
87+
lines = [ln for ln in response.text.strip().split("\n") if ln.startswith("data: ")]
9088
assert len(lines) == 4 # 3 intermediate + 1 final
9189
frames = [json.loads(ln.removeprefix("data: ")) for ln in lines]
9290
assert frames[-1]["stream_done"] is True

tests/test_streaming.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ async def test_no_event_single_frame(self):
142142
async def test_hydrate_path(self):
143143
comp = StepStreamComponent()
144144
frames = [
145-
f async for f in comp.async_stream_dispatch(
145+
f
146+
async for f in comp.async_stream_dispatch(
146147
event="process", payload={"steps": 1}, state={"step": 10, "done": False}
147148
)
148149
]
@@ -185,13 +186,15 @@ def test_basic_format(self):
185186
result = format_sse_frame(frame)
186187
assert result.startswith("data: ")
187188
assert result.endswith("\n\n")
188-
parsed = json.loads(result[len("data: "):])
189+
parsed = json.loads(result[len("data: ") :])
189190
assert parsed["html"] == "<div>test</div>"
190191

191192
def test_roundtrip_json(self):
192193
frame = {
193-
"html": "<p>hi</p>", "state": {"count": 1},
194-
"component_id": "x", "stream_done": True,
194+
"html": "<p>hi</p>",
195+
"state": {"count": 1},
196+
"component_id": "x",
197+
"stream_done": True,
195198
}
196199
result = format_sse_frame(frame)
197200
parsed = json.loads(result.removeprefix("data: ").strip())

0 commit comments

Comments
 (0)