Repository navigation
test: enable mypy typing checks for the agents tool-calling tests - #12755
Merged
davidsbatista merged 1 commit intoSep 15, 2026
Merged
davidsbatista merged 1 commit into
davidsbatista merged 1 commit into
Conversation
ShousenZHANG
requested review from
davidsbatista
and
a lite review from Copilot
and removed request for
a team
September 15, 2026 02:54
Contributor
|
@ShousenZHANG is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
7 tasks done
Adds `test/components/agents/test_tool_calling.py` and `test_utils.py` to the `types` target and fixes the 24 errors they surface. No suppressions: every one is fixed structurally. - 16 `no-untyped-def`. Eight are the missing `-> None` on `TestSelectToolsByName`, whose sibling tests in `test_agent_hooks.py` already carry it, plus `configured_tools: ToolsType` on the parametrized one, matching `_select_tools_by_name`. The rest are `add_function`, `_reader_tool` and `_writer_tool` return types and the two `ProblematicState.set` overrides, which now repeat `State.set`'s `handler_override: Callable[[Any, Any], Any] | None`. - 6 `union-attr`. `tool_messages[0].tool_call_result` is optional; narrowed once per test with `assert tool_call_result is not None` instead of at each of the three attribute reads. - 1 `var-annotated` on the `seen` accumulator. - 1 `arg-type`. `ToolCallResult.result` is a `str` or a sequence of content parts, so `json.loads` gets it through `assert isinstance(result, str)`. Part of #10396.
ShousenZHANG
force-pushed
the
test/type-check-agents-tool-calling
branch
from
September 15, 2026 06:29
b029be3 to
7fc1884
Compare
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
7 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
components/converters/), test: enable mypy typing checks for test/components/converters/image #12750, test: enable mypy typing checks for test/hooks/compaction #12749, test: enable mypy typing checks for the test/hooks root modules #12711 and test: enable mypy typing checks for test/hooks/budget #12710Proposed Changes:
Adds
test/components/agents/test_tool_calling.pyandtest_utils.pyto thetypestarget. Baseline was 24 errors. No suppressions — every one is fixed structurally.no-untyped-def. Eight are the missing-> NoneonTestSelectToolsByName, whose sibling tests intest_agent_hooks.pyalready carry it, plusconfigured_tools: ToolsTypeon the parametrized one, taken straight from_select_tools_by_name's own signature. The rest are return types onadd_function,_reader_tooland_writer_tool, and the twoProblematicState.setoverrides, which now repeatState.set'shandler_override: Callable[[Any, Any], Any] | Nonerather than leaving it bare.union-attr.tool_messages[0].tool_call_resultis optional. Narrowed once per test withassert tool_call_result is not None, rather than at each of the three attribute reads that follow — one line per test clears three errors.var-annotatedon theseenaccumulator.arg-type.ToolCallResult.resultis astror a sequence of content parts, sojson.loadsgets it throughassert isinstance(result, str). That also makes the assertion state that the tool returned a string, which it previously took for granted.test_agent.pyis left out: it carries 82 of the directory's 106 errors on its own, including 27 from stubs that setwas_warmed_uponTool/Toolset, and belongs in its own PR.How did you test it?
mypyon the two files -> 24 errors. After: zero.pyteston the two files -> 104 passed. Full unit suite -> 6399 passed.pytest -m integration test/components/agents/-> 2 passed, 4 skipped, 0 failed.ruff check/ruff format --checkover the repo -> clean, 6804 files.check_imports.py-> 262 modules.maincheckout — a newer localopenaithan the tests expect, and the Windows mime registry. Neither is touched by this change.No release note: test-only, which AGENTS.md excludes from the release-note requirement.
This PR was written with AI assistance.