remove WsStreamBlock schema and tests — no longer used
This commit is contained in:
@@ -151,7 +151,6 @@ class WsFrameType(str, Enum):
|
||||
floating_request = "floating_request"
|
||||
stream_start = "stream_start"
|
||||
stream_text = "stream_text"
|
||||
stream_block = "stream_block"
|
||||
stream_end = "stream_end"
|
||||
floating_domain = "floating_domain"
|
||||
data_request = "data_request"
|
||||
@@ -275,15 +274,6 @@ class WsStreamText(BaseModel):
|
||||
chunk: str
|
||||
|
||||
|
||||
class WsStreamBlock(BaseModel):
|
||||
"""Server → Client: structured block (chart, table, entity, timeline)."""
|
||||
|
||||
type: Literal[WsFrameType.stream_block] = WsFrameType.stream_block
|
||||
request_id: str
|
||||
block_type: Literal["chart", "entity_ref", "table", "timeline"]
|
||||
data: dict[str, Any]
|
||||
|
||||
|
||||
class WsStreamEnd(BaseModel):
|
||||
"""Server → Client: signals end of a streaming response."""
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ from app.schemas import (
|
||||
WsFloatingDomain,
|
||||
WsFloatingRequest,
|
||||
WsFloatingScope,
|
||||
WsStreamBlock,
|
||||
WsStreamEnd,
|
||||
WsStreamStart,
|
||||
WsStreamText,
|
||||
@@ -25,7 +24,6 @@ def test_v3_frame_types_exist():
|
||||
"floating_request",
|
||||
"stream_start",
|
||||
"stream_text",
|
||||
"stream_block",
|
||||
"stream_end",
|
||||
"floating_domain",
|
||||
"data_request",
|
||||
@@ -174,66 +172,6 @@ def test_stream_text_deserializes():
|
||||
assert frame.chunk == "test"
|
||||
|
||||
|
||||
# ── WsStreamBlock ─────────────────────────────────────────────────────
|
||||
|
||||
|
||||
def test_stream_block_chart():
|
||||
data = {
|
||||
"type": "chart",
|
||||
"chartType": "bar",
|
||||
"title": "Tasks",
|
||||
"data": [{"name": "Done", "count": 5}],
|
||||
"config": {"count": {"label": "Count", "color": "#4f46e5"}},
|
||||
}
|
||||
frame = WsStreamBlock(request_id="r1", block_type="chart", data=data)
|
||||
assert frame.type == WsFrameType.stream_block
|
||||
assert frame.block_type == "chart"
|
||||
assert frame.data["chartType"] == "bar"
|
||||
|
||||
|
||||
def test_stream_block_entity_ref():
|
||||
frame = WsStreamBlock(
|
||||
request_id="r1",
|
||||
block_type="entity_ref",
|
||||
data={"type": "task", "id": "t-1", "title": "Fix bug"},
|
||||
)
|
||||
assert frame.block_type == "entity_ref"
|
||||
|
||||
|
||||
def test_stream_block_table():
|
||||
frame = WsStreamBlock(
|
||||
request_id="r1",
|
||||
block_type="table",
|
||||
data={"headers": ["A", "B"], "rows": [["1", "2"]]},
|
||||
)
|
||||
assert frame.block_type == "table"
|
||||
|
||||
|
||||
def test_stream_block_timeline():
|
||||
frame = WsStreamBlock(
|
||||
request_id="r1",
|
||||
block_type="timeline",
|
||||
data={"timelines": [{"id": "c1", "title": "Launch", "date": 1700000000}]},
|
||||
)
|
||||
assert frame.block_type == "timeline"
|
||||
|
||||
|
||||
def test_stream_block_invalid_type():
|
||||
with pytest.raises(ValidationError):
|
||||
WsStreamBlock(
|
||||
request_id="r1",
|
||||
block_type="unknown", # type: ignore[arg-type]
|
||||
data={},
|
||||
)
|
||||
|
||||
|
||||
def test_stream_block_serializes():
|
||||
frame = WsStreamBlock(request_id="r1", block_type="table", data={"headers": [], "rows": []})
|
||||
d = frame.model_dump()
|
||||
assert d["type"] == "stream_block"
|
||||
assert d["block_type"] == "table"
|
||||
|
||||
|
||||
# ── WsStreamEnd ───────────────────────────────────────────────────────
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user