File size: 886 Bytes
8a87cbb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import pytest

from aegis.core.tool_registry import ToolRegistry
from aegis.core.tool_runner import ToolRunner


class EchoTool:
    name = "echo"

    async def execute(self, **kwargs: object) -> object:
        return kwargs


@pytest.mark.asyncio
async def test_tool_runner_executes_registered_tool() -> None:
    registry = ToolRegistry([EchoTool()])
    runner = ToolRunner(registry)

    result = await runner.execute(
        "echo",
        message="hello",
        value=42,
    )

    assert result == {
        "message": "hello",
        "value": 42,
    }


@pytest.mark.asyncio
async def test_tool_runner_preserves_arguments() -> None:
    registry = ToolRegistry([EchoTool()])
    runner = ToolRunner(registry)

    result = await runner.execute(
        "echo",
        alpha=1,
        beta=2,
    )

    assert result == {
        "alpha": 1,
        "beta": 2,
    }