feat(gui): Implement on-demand definition lookup with clickable navigation and collapsing
This commit is contained in:
@@ -32,24 +32,25 @@ class TestSymbolLookup(unittest.TestCase):
|
||||
files = ["file1.py", "file2.py"]
|
||||
symbol = "my_func"
|
||||
def_content = "def my_func():\n pass"
|
||||
line_number = 10
|
||||
|
||||
with patch("src.mcp_client.py_get_definition") as mock_get_def:
|
||||
with patch("src.mcp_client.py_get_symbol_info") as mock_get_info:
|
||||
# First file not found, second file found
|
||||
mock_get_def.side_effect = [
|
||||
mock_get_info.side_effect = [
|
||||
"ERROR: definition 'my_func' not found in file1.py",
|
||||
def_content
|
||||
(def_content, line_number)
|
||||
]
|
||||
|
||||
result = get_symbol_definition(symbol, files)
|
||||
self.assertEqual(result, ("file2.py", def_content))
|
||||
self.assertEqual(mock_get_def.call_count, 2)
|
||||
self.assertEqual(result, ("file2.py", def_content, line_number))
|
||||
self.assertEqual(mock_get_info.call_count, 2)
|
||||
|
||||
def test_get_symbol_definition_not_found(self):
|
||||
files = ["file1.py"]
|
||||
symbol = "my_func"
|
||||
|
||||
with patch("src.mcp_client.py_get_definition") as mock_get_def:
|
||||
mock_get_def.return_value = "ERROR: definition 'my_func' not found in file1.py"
|
||||
with patch("src.mcp_client.py_get_symbol_info") as mock_get_info:
|
||||
mock_get_info.return_value = "ERROR: definition 'my_func' not found in file1.py"
|
||||
|
||||
result = get_symbol_definition(symbol, files)
|
||||
self.assertIsNone(result)
|
||||
|
||||
Reference in New Issue
Block a user