33import pytest
44
55from deepset_mcp .api .exceptions import UnexpectedAPIError
6- from deepset_mcp .tools .haystack_service import list_component_families
6+ from deepset_mcp .tools .haystack_service import get_component_definition , list_component_families
77from test .unit .conftest import BaseFakeClient
88
99
@@ -35,7 +35,7 @@ def haystack_service(self) -> FakeHaystackServiceResource:
3535async def test_get_component_definition_success () -> None :
3636 # Sample component definition similar to the example provided
3737 component_type = "haystack.components.converters.xlsx.XLSXToDocument"
38- response = {
38+ response : dict [ str , Any ] = {
3939 "component_schema" : {
4040 "definitions" : {
4141 "Components" : {
@@ -46,33 +46,33 @@ async def test_get_component_definition_success() -> None:
4646 "type" : {
4747 "const" : component_type ,
4848 "family" : "converters" ,
49- "family_description" : "Convert data into a format your pipeline can query."
49+ "family_description" : "Convert data into a format your pipeline can query." ,
5050 },
5151 "init_parameters" : {
5252 "properties" : {
5353 "sheet_name" : {
5454 "_annotation" : "typing.Union[str, int, list, None]" ,
5555 "description" : "The name of the sheet to read." ,
56- "default" : None
56+ "default" : None ,
5757 },
5858 "table_format" : {
5959 "_annotation" : "str" ,
6060 "description" : "The format to convert the Excel file to." ,
61- "default" : "csv"
62- }
61+ "default" : "csv" ,
62+ },
6363 }
64- }
65- }
64+ },
65+ },
6666 }
6767 }
6868 }
6969 }
7070 }
71-
71+
7272 resource = FakeHaystackServiceResource (get_component_schemas_response = response )
7373 client = FakeClient (resource )
7474 result = await get_component_definition (client , component_type )
75-
75+
7676 # Check that all required information is present
7777 assert component_type in result
7878 assert "XLSXToDocument" in result
@@ -85,13 +85,7 @@ async def test_get_component_definition_success() -> None:
8585
8686@pytest .mark .asyncio
8787async def test_get_component_definition_not_found () -> None :
88- response = {
89- "component_schema" : {
90- "definitions" : {
91- "Components" : {}
92- }
93- }
94- }
88+ response : dict [str , Any ] = {"component_schema" : {"definitions" : {"Components" : {}}}}
9589 resource = FakeHaystackServiceResource (get_component_schemas_response = response )
9690 client = FakeClient (resource )
9791 result = await get_component_definition (client , "nonexistent.component" )
0 commit comments