@@ -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+ )
0 commit comments