style: Run linter

This commit is contained in:
Paul Gauthier (aider) 2024-08-28 15:15:54 -07:00
parent 8180fb06b0
commit 6e3278afb7

View file

@ -620,8 +620,8 @@ class TestMain(TestCase):
) )
self.assertTrue(coder.suggest_shell_commands) self.assertTrue(coder.suggest_shell_commands)
@patch('aider.main.InputOutput') @patch("aider.main.InputOutput")
@patch('aider.main.Path') @patch("aider.main.Path")
def test_setup_git_home_existing_repo(self, mock_path, mock_io): def test_setup_git_home_existing_repo(self, mock_path, mock_io):
mock_io_instance = mock_io.return_value mock_io_instance = mock_io.return_value
mock_io_instance.prompt_ask.return_value = "1" mock_io_instance.prompt_ask.return_value = "1"
@ -630,12 +630,14 @@ class TestMain(TestCase):
result = setup_git_home(mock_io_instance) result = setup_git_home(mock_io_instance)
self.assertEqual(result, Path("/home/user/repo1")) self.assertEqual(result, Path("/home/user/repo1"))
mock_io_instance.tool_output.assert_called_with("Found git repositories in your home directory:") mock_io_instance.tool_output.assert_called_with(
"Found git repositories in your home directory:"
)
mock_io_instance.prompt_ask.assert_called() mock_io_instance.prompt_ask.assert_called()
@patch('aider.main.InputOutput') @patch("aider.main.InputOutput")
@patch('aider.main.Path') @patch("aider.main.Path")
@patch('aider.main.make_new_repo') @patch("aider.main.make_new_repo")
def test_setup_git_home_new_repo(self, mock_make_new_repo, mock_path, mock_io): def test_setup_git_home_new_repo(self, mock_make_new_repo, mock_path, mock_io):
mock_io_instance = mock_io.return_value mock_io_instance = mock_io.return_value
mock_io_instance.prompt_ask.return_value = "new_project" mock_io_instance.prompt_ask.return_value = "new_project"
@ -646,8 +648,8 @@ class TestMain(TestCase):
self.assertEqual(result, Path("/home/user/new_project")) self.assertEqual(result, Path("/home/user/new_project"))
mock_make_new_repo.assert_called_with(Path("/home/user/new_project"), mock_io_instance) mock_make_new_repo.assert_called_with(Path("/home/user/new_project"), mock_io_instance)
@patch('aider.main.InputOutput') @patch("aider.main.InputOutput")
@patch('aider.main.Path') @patch("aider.main.Path")
def test_setup_git_home_no_repos(self, mock_path, mock_io): def test_setup_git_home_no_repos(self, mock_path, mock_io):
mock_io_instance = mock_io.return_value mock_io_instance = mock_io.return_value
mock_path.home.return_value.glob.return_value = [] mock_path.home.return_value.glob.return_value = []
@ -658,12 +660,15 @@ class TestMain(TestCase):
mock_io_instance.tool_output.assert_not_called() mock_io_instance.tool_output.assert_not_called()
mock_io_instance.prompt_ask.assert_not_called() mock_io_instance.prompt_ask.assert_not_called()
@patch('aider.main.InputOutput') @patch("aider.main.InputOutput")
@patch('aider.main.Path') @patch("aider.main.Path")
def test_setup_git_home_invalid_choice(self, mock_path, mock_io): def test_setup_git_home_invalid_choice(self, mock_path, mock_io):
mock_io_instance = mock_io.return_value mock_io_instance = mock_io.return_value
mock_io_instance.prompt_ask.side_effect = ["3", "1"] mock_io_instance.prompt_ask.side_effect = ["3", "1"]
mock_path.home.return_value.glob.return_value = [Path("/home/user/repo1/.git"), Path("/home/user/repo2/.git")] mock_path.home.return_value.glob.return_value = [
Path("/home/user/repo1/.git"),
Path("/home/user/repo2/.git"),
]
result = setup_git_home(mock_io_instance) result = setup_git_home(mock_io_instance)