[MyPy][3/N] Fix MyPy errors in test groups (part 3) (#55939)

Signed-off-by: Taimys <ffy2281693949@gmail.com>
Signed-off-by: Luyi Xiao <81631911+luyixiao95@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Luyi Xiao <81631911+luyixiao95@users.noreply.github.com>
Co-authored-by: Taimys <ffy2281693949@gmail.com>
Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Taimys
2026-09-30 11:06:07 +00:00
committed by GitHub
co-authored by Codex Luyi Xiao Taimys Harry Mellor Claude Opus 5.5
parent c4fa6f36a7
commit 5225f1bacb
118 changed files with 948 additions and 605 deletions
@@ -355,9 +355,11 @@ class TestToolResultContent:
if m["role"] == "user" and isinstance(m.get("content"), list)
]
assert len(follow_up) == 1
assert follow_up[0]["content"][0]["image_url"]["url"] == (
"data:image/jpeg;base64,QUFB"
)
content = follow_up[0]["content"]
assert isinstance(content, list)
image = content[0]
assert image["type"] == "image_url"
assert image["image_url"]["url"] == "data:image/jpeg;base64,QUFB"
def test_tool_result_with_multiple_images(self):
request = self._make_tool_result_request(
@@ -387,7 +389,12 @@ class TestToolResultContent:
if m["role"] == "user" and isinstance(m.get("content"), list)
]
assert len(follow_up) == 1
urls = [p["image_url"]["url"] for p in follow_up[0]["content"]]
content = follow_up[0]["content"]
assert isinstance(content, list)
urls = []
for part in content:
assert part["type"] == "image_url"
urls.append(part["image_url"]["url"])
assert urls == [
"data:image/png;base64,IMG1",
"https://example.com/img2.jpg",
@@ -584,7 +591,8 @@ class TestThinkingBlockConversion:
asst = asst_msgs[0]
assert asst.get("reasoning") == "I need to call the calculator."
tool_calls = list(asst.get("tool_calls", []))
tool_calls = asst.get("tool_calls")
assert tool_calls is not None
assert len(tool_calls) == 1
assert tool_calls[0]["function"]["name"] == "calculator"
# No text content alongside reasoning + tool_use.
@@ -1439,7 +1447,7 @@ class TestDetectMergeInlineSystem:
model_config=None,
)
assert (
AnthropicServingMessages._should_merge_inline_system(online_renderer)
AnthropicServingMessages._should_merge_inline_system(online_renderer) # type: ignore[arg-type]
is expected
)
assert mock_logger.warning_once.called is expected