From af978fe1946fed2f0b3b7ff01f826099c1ce4bf8 Mon Sep 17 00:00:00 2001 From: "Xiang (Sean) Zhou" Date: Tue, 13 May 2025 15:31:47 -0700 Subject: [PATCH] fix apihub toolset ut PiperOrigin-RevId: 758400203 --- .../tools/apihub_tool/test_apihub_toolset.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/unittests/tools/apihub_tool/test_apihub_toolset.py b/tests/unittests/tools/apihub_tool/test_apihub_toolset.py index 139c0c4..99de0e6 100644 --- a/tests/unittests/tools/apihub_tool/test_apihub_toolset.py +++ b/tests/unittests/tools/apihub_tool/test_apihub_toolset.py @@ -24,7 +24,7 @@ import yaml class MockAPIHubClient(BaseAPIHubClient): - def get_spec_content(self, apihub_resource_name: str) -> str: + def get_spec_content(self, _apihub_resource_name: str) -> str: return """ openapi: 3.0.0 info: @@ -81,8 +81,8 @@ def mock_auth_credential(): async def test_apihub_toolset_initialization(basic_apihub_toolset): assert basic_apihub_toolset.name == 'mock_api' assert basic_apihub_toolset.description == 'Mock API Description' - assert basic_apihub_toolset.apihub_resource_name == 'test_resource' - assert not basic_apihub_toolset.lazy_load_spec + assert basic_apihub_toolset._apihub_resource_name == 'test_resource' + assert not basic_apihub_toolset._lazy_load_spec generated_tools = await basic_apihub_toolset.get_tools() assert len(generated_tools) == 1 assert 'test_get' == generated_tools[0].name @@ -90,7 +90,7 @@ async def test_apihub_toolset_initialization(basic_apihub_toolset): @pytest.mark.asyncio async def test_apihub_toolset_lazy_loading(lazy_apihub_toolset): - assert lazy_apihub_toolset.lazy_load_spec + assert lazy_apihub_toolset._lazy_load_spec generated_tools = await lazy_apihub_toolset.get_tools() assert generated_tools @@ -116,7 +116,7 @@ paths: class MockAPIHubClientEmptySpec(BaseAPIHubClient): - def get_spec_content(self, apihub_resource_name: str) -> str: + def get_spec_content(self, _apihub_resource_name: str) -> str: return spec apihub_client = MockAPIHubClientEmptySpec() @@ -146,7 +146,7 @@ paths: class MockAPIHubClientEmptySpec(BaseAPIHubClient): - def get_spec_content(self, apihub_resource_name: str) -> str: + def get_spec_content(self, _apihub_resource_name: str) -> str: return spec apihub_client = MockAPIHubClientEmptySpec() @@ -177,7 +177,7 @@ async def test_apihub_toolset_get_tools_lazy_load_empty_spec(): class MockAPIHubClientEmptySpec(BaseAPIHubClient): - def get_spec_content(self, apihub_resource_name: str) -> str: + def get_spec_content(self, _apihub_resource_name: str) -> str: return '' apihub_client = MockAPIHubClientEmptySpec() @@ -195,7 +195,7 @@ async def test_apihub_toolset_get_tools_invalid_yaml(): class MockAPIHubClientInvalidYAML(BaseAPIHubClient): - def get_spec_content(self, apihub_resource_name: str) -> str: + def get_spec_content(self, _apihub_resource_name: str) -> str: return '{invalid yaml' # Return invalid YAML with pytest.raises(yaml.YAMLError):