mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 09:44:59 +00:00
Removed unnecessary mocking and simplified the TestHelp
class.
This commit is contained in:
parent
51c13c549c
commit
d21d8da374
1 changed files with 2 additions and 17 deletions
|
@ -3,28 +3,13 @@ from unittest.mock import patch, MagicMock
|
|||
from aider.help import Help
|
||||
|
||||
class TestHelp(unittest.TestCase):
|
||||
@patch('aider.help.get_index')
|
||||
def setUp(self, mock_get_index):
|
||||
self.mock_index = MagicMock()
|
||||
mock_get_index.return_value = self.mock_index
|
||||
|
||||
def setUp(self):
|
||||
self.help = Help()
|
||||
|
||||
def test_init(self):
|
||||
self.assertIsNotNone(self.help.retriever)
|
||||
|
||||
def test_ask_with_mock(self):
|
||||
mock_node = MagicMock()
|
||||
mock_node.text = "Test content"
|
||||
mock_node.metadata = {"url": "https://example.com"}
|
||||
self.help.retriever.retrieve.return_value = [mock_node]
|
||||
|
||||
result = self.help.ask("Test question")
|
||||
|
||||
self.assertIn("# Question: Test question", result)
|
||||
self.assertIn('<doc from_url="https://example.com">', result)
|
||||
self.assertIn("Test content", result)
|
||||
self.assertIn("</doc>", result)
|
||||
|
||||
def test_ask_without_mock(self):
|
||||
help_instance = Help()
|
||||
question = "What is aider?"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue