Skip to content

Commit 5618597

Browse files
Formatted
1 parent 005483a commit 5618597

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

tests/client/test_list_roots_callback.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,21 @@ async def test_list_roots_callback():
2020

2121
server = FastMCP("test")
2222

23-
callback_return = ListRootsResult(roots=[
24-
Root(
25-
uri=FileUrl("file://users/fake/test"),
26-
name="Test Root 1",
27-
),
28-
Root(
29-
uri=FileUrl("file://users/fake/test/2"),
30-
name="Test Root 2",
31-
)
32-
])
23+
callback_return = ListRootsResult(
24+
roots=[
25+
Root(
26+
uri=FileUrl("file://users/fake/test"),
27+
name="Test Root 1",
28+
),
29+
Root(
30+
uri=FileUrl("file://users/fake/test/2"),
31+
name="Test Root 2",
32+
),
33+
]
34+
)
3335

3436
async def list_roots_callback(
35-
context: RequestContext[ClientSession, None]
37+
context: RequestContext[ClientSession, None],
3638
) -> ListRootsResult:
3739
return callback_return
3840

@@ -52,7 +54,7 @@ async def test_list_roots(context: Context, message: str):
5254
)
5355
assert result.isError is False
5456
assert isinstance(result.content[0], TextContent)
55-
assert result.content[0].text == 'true'
57+
assert result.content[0].text == "true"
5658

5759
# Test without list_roots callback
5860
async with create_session(server._mcp_server) as client_session:
@@ -62,5 +64,7 @@ async def test_list_roots(context: Context, message: str):
6264
)
6365
assert result.isError is True
6466
assert isinstance(result.content[0], TextContent)
65-
assert result.content[0].text == 'Error executing tool test_list_roots: List roots not supported'
66-
67+
assert (
68+
result.content[0].text
69+
== "Error executing tool test_list_roots: List roots not supported"
70+
)

tests/client/test_sampling_callback.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async def test_sampling_tool(message: str):
5757
)
5858
assert result.isError is False
5959
assert isinstance(result.content[0], TextContent)
60-
assert result.content[0].text == 'true'
60+
assert result.content[0].text == "true"
6161

6262
# Test without sampling callback
6363
async with create_session(server._mcp_server) as client_session:
@@ -67,4 +67,7 @@ async def test_sampling_tool(message: str):
6767
)
6868
assert result.isError is True
6969
assert isinstance(result.content[0], TextContent)
70-
assert result.content[0].text == 'Error executing tool test_sampling: Sampling not supported'
70+
assert (
71+
result.content[0].text
72+
== "Error executing tool test_sampling: Sampling not supported"
73+
)

0 commit comments

Comments
 (0)