fix(anthropic): cast MessageFinishData to dict for metadata access in test

The `MessageFinishData` TypedDict doesn't declare the `metadata` key
that the compat bridge injects at runtime. Cast to `dict[str, Any]` to
satisfy mypy, matching the existing pattern used for content blocks in
the same test.
This commit is contained in:
Nick Hollon
2026-04-29 11:31:49 -04:00
parent 9e1ee842fb
commit 0e1ebc250e

View File

@@ -3206,6 +3206,6 @@ def test_anthropic_stream_v2_lifecycle() -> None:
# (protocol 0.0.9 moved the finish reason off the top-level event
# and into `metadata`, where the bridge deposits the provider's raw
# `stop_reason` alongside other response metadata).
message_finish = stream_events[-1]
message_finish = cast("dict[str, Any]", stream_events[-1])
assert message_finish["event"] == "message-finish"
assert message_finish["metadata"]["stop_reason"] == "tool_use"