Skip to content

Commit cdb2d10

Browse files
committed
Fix lints
1 parent 9d2bf94 commit cdb2d10

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

tests/lib/core/tracing/processors/test_sgp_tracing_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ async def test_sgp_span_input_updated_on_end(self):
175175
assert len(processor._spans) == 1
176176

177177
# Simulate modified input at end time
178-
updated_input = {"messages": [
178+
updated_input: dict[str, object] = {"messages": [
179179
{"role": "user", "content": "hello"},
180180
{"role": "assistant", "content": "hi"},
181181
]}

tests/lib/core/tracing/test_span_queue.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import uuid
55
import asyncio
66
from datetime import UTC, datetime
7+
from typing import cast
78
from unittest.mock import AsyncMock, MagicMock, patch
89

910
from agentex.types.span import Span
@@ -287,12 +288,13 @@ async def capture_end(span: Span) -> None:
287288
span_queue=queue,
288289
)
289290

290-
initial_input = {"messages": [{"role": "user", "content": "hello"}]}
291+
initial_input: dict[str, object] = {"messages": [{"role": "user", "content": "hello"}]}
291292
async with trace.span("llm-call", input=initial_input) as span:
292293
# Simulate modifying input after start (e.g. chatbot appending messages)
293-
span.input["messages"].append({"role": "assistant", "content": "hi there"})
294-
span.input["messages"].append({"role": "user", "content": "how are you?"})
295-
span.output = {"response": "I'm good!"}
294+
messages = cast(list[dict[str, str]], cast(dict[str, object], span.input)["messages"])
295+
messages.append({"role": "assistant", "content": "hi there"})
296+
messages.append({"role": "user", "content": "how are you?"})
297+
span.output = cast(dict[str, object], {"response": "I'm good!"})
296298

297299
await queue.shutdown()
298300

@@ -301,11 +303,11 @@ async def capture_end(span: Span) -> None:
301303

302304
# START should carry the original input (serialized at start time)
303305
assert start_spans[0].input is not None
304-
assert len(start_spans[0].input["messages"]) == 1 # only the original message
306+
assert len(cast(dict[str, list[object]], start_spans[0].input)["messages"]) == 1 # only the original message
305307

306308
# END should carry the modified input (re-serialized at end time)
307309
assert end_spans[0].input is not None
308-
assert len(end_spans[0].input["messages"]) == 3 # all three messages
310+
assert len(cast(dict[str, list[object]], end_spans[0].input)["messages"]) == 3 # all three messages
309311

310312
# END should still carry output and end_time
311313
assert end_spans[0].output is not None

0 commit comments

Comments
 (0)