(self)
| 81 | assert received_params.count == 42 |
| 82 | |
| 83 | async def test_handler_receives_invocation(self): |
| 84 | class Params(BaseModel): |
| 85 | pass |
| 86 | |
| 87 | received_inv = None |
| 88 | |
| 89 | @define_tool("test", description="Test tool") |
| 90 | def test_tool(params: Params, invocation: ToolInvocation) -> str: |
| 91 | nonlocal received_inv |
| 92 | received_inv = invocation |
| 93 | return "ok" |
| 94 | |
| 95 | invocation = ToolInvocation( |
| 96 | session_id="session-123", |
| 97 | tool_call_id="call-456", |
| 98 | tool_name="test", |
| 99 | arguments={}, |
| 100 | ) |
| 101 | |
| 102 | await test_tool.handler(invocation) |
| 103 | |
| 104 | assert received_inv.session_id == "session-123" |
| 105 | assert received_inv.tool_call_id == "call-456" |
| 106 | |
| 107 | async def test_zero_param_handler(self): |
| 108 | """Handler with no parameters: def handler() -> str""" |
nothing calls this directly
no test coverage detected