Skip to content

test: add unit tests for tool use example#1222

Open
ozge-devops wants to merge 1 commit intoanthropics:mainfrom
ozge-devops:patch-1
Open

test: add unit tests for tool use example#1222
ozge-devops wants to merge 1 commit intoanthropics:mainfrom
ozge-devops:patch-1

Conversation

@ozge-devops
Copy link

Description

Add unit tests for the tool use example (examples/tool_use.py).

Test coverage

  • get_weather() – known locations,unknown locations,default values
  • Temperature unit conversion(Celsius → Fahrenheit)
  • process_tool_call() – routing,error handling, JSON validation
  • Full tool use loop with mocked API (no API key required)

Details

  • 5 test classes,16 test functions
  • Uses pytest.mark.parametrize for data-driven testing
  • Uses unittest.mock to simulate API responses
  • All tests run offline without API credentials

test: add unit tests for tool use example
@ozge-devops ozge-devops requested a review from a team as a code owner March 5, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant