Skip to content

Commit b5fbdda

Browse files
f
1 parent a0cca8d commit b5fbdda

File tree

4 files changed

+305
-4
lines changed

4 files changed

+305
-4
lines changed

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,9 @@ markers = [
4949
dev = [
5050
"ruff>=0.13.2",
5151
"mypy>=1.8.0",
52+
"pytest>=8.0.0",
53+
"pytest-asyncio>=0.24.0",
54+
"pydantic-settings>=2.0.0",
55+
"python-dotenv>=1.0.0",
56+
"langchain-tests==1.1.2",
5257
]

python/langchain-ampersend/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ build-backend = "uv_build"
1818
test = [
1919
"pytest>=8.0.0",
2020
"pytest-asyncio>=0.24.0",
21+
"langchain-tests==1.1.2", # Pin to avoid breaking CI
2122
]
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
"""Standard LangChain unit tests for tools."""
2+
3+
from typing import Type
4+
from unittest.mock import MagicMock
5+
6+
from a2a.types import AgentCapabilities, AgentCard
7+
from langchain_ampersend.a2a.toolkit import (
8+
A2AToolkit,
9+
GetAgentDetailsTool,
10+
SendMessageTool,
11+
)
12+
from langchain_tests.unit_tests import ToolsUnitTests
13+
14+
15+
def _make_mock_toolkit() -> A2AToolkit:
16+
"""Create a mock toolkit with initialized card."""
17+
mock_treasurer = MagicMock()
18+
toolkit = A2AToolkit(
19+
remote_agent_url="http://test-agent.com",
20+
treasurer=mock_treasurer,
21+
)
22+
toolkit._card = AgentCard(
23+
name="test_agent",
24+
description="A test agent",
25+
url="http://test-agent.com",
26+
capabilities=AgentCapabilities(streaming=True),
27+
default_input_modes=[],
28+
default_output_modes=[],
29+
skills=[],
30+
version="1.0.0",
31+
)
32+
return toolkit
33+
34+
35+
class TestGetAgentDetailsToolStandard(ToolsUnitTests):
36+
@property
37+
def tool_constructor(self) -> Type[GetAgentDetailsTool]:
38+
return GetAgentDetailsTool
39+
40+
@property
41+
def tool_constructor_params(self) -> dict:
42+
return {"toolkit": _make_mock_toolkit()}
43+
44+
@property
45+
def tool_invoke_params_example(self) -> dict:
46+
return {} # GetAgentDetailsTool takes no parameters
47+
48+
49+
class TestSendMessageToolStandard(ToolsUnitTests):
50+
@property
51+
def tool_constructor(self) -> Type[SendMessageTool]:
52+
return SendMessageTool
53+
54+
@property
55+
def tool_constructor_params(self) -> dict:
56+
return {"toolkit": _make_mock_toolkit()}
57+
58+
@property
59+
def tool_invoke_params_example(self) -> dict:
60+
return {"message": "Hello, agent!"}

0 commit comments

Comments
 (0)