Skip to content

test(tools): add unit tests for ToolConfirmation#6208

Open
Koushik-Salammagari wants to merge 2 commits into
google:mainfrom
Koushik-Salammagari:test/tool-confirmation-coverage
Open

test(tools): add unit tests for ToolConfirmation#6208
Koushik-Salammagari wants to merge 2 commits into
google:mainfrom
Koushik-Salammagari:test/tool-confirmation-coverage

Conversation

@Koushik-Salammagari

Copy link
Copy Markdown
Contributor

Link to Issue or Description of Change

Description of the change (no existing issue):

Problem:
The ToolConfirmation model in google.adk.tools.tool_confirmation had no
dedicated unit-test coverage.

Solution:
Add a focused, test-only module. No production code is changed. The model is
gated behind an experimental feature flag (which emits a UserWarning on use);
the tests filter that expected warning.

Coverage added:

  • Default values (hint="", confirmed=False, payload=None).
  • Custom values are stored as provided.
  • payload accepts arbitrary JSON-serializable values (lists, strings).
  • extra="forbid" rejects unknown fields with a ValidationError.
  • The model round-trips through model_dump/model_validate.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.
$ pytest tests/unittests/tools/test_tool_confirmation.py -q
...
5 passed in 0.96s

Manual End-to-End (E2E) Tests:

Not applicable — this is a test-only change with no runtime/user-facing impact.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Adds unit-test coverage for the previously untested ToolConfirmation model:
default values, custom values, arbitrary JSON-serializable payloads,
extra-field rejection (extra=forbid), and dict round-tripping.
@adk-bot adk-bot added the tools [Component] This issue is related to tools label Jun 23, 2026
@rohityan rohityan self-assigned this Jun 24, 2026
@rohityan rohityan requested a review from DeanChensj June 26, 2026 20:48
@rohityan rohityan added the needs review [Status] The PR/issue is awaiting review from the maintainer label Jun 26, 2026
@rohityan

Copy link
Copy Markdown
Collaborator

Hi @Koushik-Salammagari ,Thank you for your contribution! We appreciate you taking the time to submit this pull request. Your PR has been received by the team and is currently under review. We will provide feedback as soon as we have an update to share.

@rohityan

Copy link
Copy Markdown
Collaborator

Hi @DeanChensj can you please review this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review [Status] The PR/issue is awaiting review from the maintainer tools [Component] This issue is related to tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants