Files
cleveragents-core/robot/scripts/test_missing_tool.py

29 lines
727 B
Python

"""Robot helper: verify WrappedToolExecutor raises on missing tool."""
from cleveragents.domain.models.core.tool import (
ToolSource,
ToolType,
Validation,
ValidationMode,
)
from cleveragents.tool.wrapping import WrappedToolExecutor, WrappedToolNotFoundError
val = Validation(
name="local/check",
description="check",
source=ToolSource.WRAPPED,
tool_type=ToolType.VALIDATION,
mode=ValidationMode.REQUIRED,
wraps="local/missing",
transform='def transform(x):\n return {"passed": True}\n',
)
ok = False
try:
WrappedToolExecutor(
lambda n: None,
lambda n, a: {},
).execute(val, {})
except WrappedToolNotFoundError:
ok = True
print(f"error_raised={ok}")