|
13 | 13 | # limitations under the License.
|
14 | 14 |
|
15 | 15 | from inspect import Parameter, signature
|
16 |
| -from typing import Annotated, Any, Optional |
| 16 | +from typing import Any, Optional |
17 | 17 |
|
18 | 18 | import pytest
|
19 | 19 | import pytest_asyncio
|
@@ -243,24 +243,15 @@ async def test_tool_signature_is_correct(self, toolbox: ToolboxClient):
|
243 | 243 |
|
244 | 244 | # The required parameter should have no default
|
245 | 245 | assert sig.parameters["email"].default is Parameter.empty
|
246 |
| - assert ( |
247 |
| - sig.parameters["email"].annotation |
248 |
| - is Annotated[str, "The email to search for."] |
249 |
| - ) |
| 246 | + assert sig.parameters["email"].annotation is str |
250 | 247 |
|
251 | 248 | # The optional parameter should have a default of None
|
252 | 249 | assert sig.parameters["data"].default is None
|
253 |
| - assert ( |
254 |
| - sig.parameters["data"].annotation |
255 |
| - is Annotated[Optional[str], "The row to narrow down the search."] |
256 |
| - ) |
| 250 | + assert sig.parameters["data"].annotation is Optional[str] |
257 | 251 |
|
258 | 252 | # The optional parameter should have a default of None
|
259 | 253 | assert sig.parameters["id"].default is None
|
260 |
| - assert ( |
261 |
| - sig.parameters["id"].annotation |
262 |
| - is Annotated[Optional[int], "The id to narrow down the search."] |
263 |
| - ) |
| 254 | + assert sig.parameters["id"].annotation is Optional[int] |
264 | 255 |
|
265 | 256 | async def test_run_tool_with_optional_params_omitted(self, toolbox: ToolboxClient):
|
266 | 257 | """Invoke a tool providing only the required parameter."""
|
@@ -404,27 +395,15 @@ async def test_tool_signature_with_map_params(self, toolbox: ToolboxClient):
|
404 | 395 | sig = signature(tool)
|
405 | 396 |
|
406 | 397 | assert "execution_context" in sig.parameters
|
407 |
| - assert ( |
408 |
| - sig.parameters["execution_context"].annotation |
409 |
| - == Annotated[ |
410 |
| - dict[str, Any], |
411 |
| - "A flexible set of key-value pairs for the execution environment.", |
412 |
| - ] |
413 |
| - ) |
| 398 | + assert sig.parameters["execution_context"].annotation == dict[str, Any] |
414 | 399 | assert sig.parameters["execution_context"].default is Parameter.empty
|
415 | 400 |
|
416 | 401 | assert "user_scores" in sig.parameters
|
417 |
| - assert ( |
418 |
| - sig.parameters["user_scores"].annotation |
419 |
| - == Annotated[dict[str, int], "A map of user IDs to their scores."] |
420 |
| - ) |
| 402 | + assert sig.parameters["user_scores"].annotation == dict[str, int] |
421 | 403 | assert sig.parameters["user_scores"].default is Parameter.empty
|
422 | 404 |
|
423 | 405 | assert "feature_flags" in sig.parameters
|
424 |
| - assert ( |
425 |
| - sig.parameters["feature_flags"].annotation |
426 |
| - == Annotated[Optional[dict[str, bool]], "Optional feature flags."] |
427 |
| - ) |
| 406 | + assert sig.parameters["feature_flags"].annotation == Optional[dict[str, bool]] |
428 | 407 | assert sig.parameters["feature_flags"].default is None
|
429 | 408 |
|
430 | 409 | async def test_run_tool_with_map_params(self, toolbox: ToolboxClient):
|
|
0 commit comments