From 10129dfbe767b79557fa181f63eda9c0f0ad83fd Mon Sep 17 00:00:00 2001 From: Anas Khan <83116240+anxkhn@users.noreply.github.com> Date: Sun, 5 Jul 2026 00:21:08 +0530 Subject: [PATCH] test(mcp): assert stored tool_filter in McpToolset init test test_init_with_tool_filter_list asserted `toolset._is_tool_selected is not None`, but `_is_tool_selected` is a method inherited from BaseToolset, so it is a bound method that is always non-None on every instance regardless of whether tool_filter was retained. The assertion could never fail and never checked what the test name promises: that the list filter is stored. A regression that dropped or mis-stored tool_filter in __init__ would still pass. Assert the stored value directly (`toolset.tool_filter == tool_filter`), matching the sibling init tests that check `toolset._connection_params == params`. The get_tools list-filtering behavior remains covered by test_get_tools_with_list_filter. Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com> --- tests/unittests/tools/mcp_tool/test_mcp_toolset.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/unittests/tools/mcp_tool/test_mcp_toolset.py b/tests/unittests/tools/mcp_tool/test_mcp_toolset.py index 0cdb72c96b..e05c0a48a9 100644 --- a/tests/unittests/tools/mcp_tool/test_mcp_toolset.py +++ b/tests/unittests/tools/mcp_tool/test_mcp_toolset.py @@ -196,9 +196,8 @@ def test_init_with_tool_filter_list(self): connection_params=self.mock_stdio_params, tool_filter=tool_filter ) - # The tool filter is stored in the parent BaseToolset class - # We can verify it by checking the filtering behavior in get_tools - assert toolset._is_tool_selected is not None + # The tool filter is stored on the parent BaseToolset class. + assert toolset.tool_filter == tool_filter def test_init_with_auth(self): """Test initialization with authentication."""