mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 12:24:59 +00:00
style: format code with black
This commit is contained in:
parent
f43cc7f6c6
commit
4074096cd1
1 changed files with 35 additions and 29 deletions
|
@ -77,53 +77,59 @@ class TestMain(TestCase):
|
||||||
self.assertTrue((subdir / "foo.txt").exists())
|
self.assertTrue((subdir / "foo.txt").exists())
|
||||||
self.assertTrue((subdir / "bar.txt").exists())
|
self.assertTrue((subdir / "bar.txt").exists())
|
||||||
|
|
||||||
@patch('aider.main.Path.home')
|
@patch("aider.main.Path.home")
|
||||||
@patch('aider.main.Path.glob')
|
@patch("aider.main.Path.glob")
|
||||||
@patch('aider.main.os.chdir')
|
@patch("aider.main.os.chdir")
|
||||||
@patch('aider.main.InputOutput')
|
@patch("aider.main.InputOutput")
|
||||||
def test_setup_git_home_existing_repo(self, mock_io, mock_chdir, mock_glob, mock_home):
|
def test_setup_git_home_existing_repo(self, mock_io, mock_chdir, mock_glob, mock_home):
|
||||||
mock_home.return_value = Path('/home/user')
|
mock_home.return_value = Path("/home/user")
|
||||||
mock_glob.return_value = [Path('/home/user/repo1/.git'), Path('/home/user/repo2/.git')]
|
mock_glob.return_value = [Path("/home/user/repo1/.git"), Path("/home/user/repo2/.git")]
|
||||||
mock_io.return_value.prompt_ask.return_value = '1'
|
mock_io.return_value.prompt_ask.return_value = "1"
|
||||||
|
|
||||||
result = setup_git_home(mock_io.return_value)
|
result = setup_git_home(mock_io.return_value)
|
||||||
|
|
||||||
mock_io.return_value.tool_output.assert_called_with("Found git repositories in your home directory:")
|
mock_io.return_value.tool_output.assert_called_with(
|
||||||
|
"Found git repositories in your home directory:"
|
||||||
|
)
|
||||||
mock_io.return_value.prompt_ask.assert_called_once()
|
mock_io.return_value.prompt_ask.assert_called_once()
|
||||||
mock_chdir.assert_called_once_with(Path('/home/user/repo1'))
|
mock_chdir.assert_called_once_with(Path("/home/user/repo1"))
|
||||||
self.assertEqual(result, str(Path('/home/user/repo1')))
|
self.assertEqual(result, str(Path("/home/user/repo1")))
|
||||||
|
|
||||||
@patch('aider.main.Path.home')
|
@patch("aider.main.Path.home")
|
||||||
@patch('aider.main.Path.glob')
|
@patch("aider.main.Path.glob")
|
||||||
@patch('aider.main.os.chdir')
|
@patch("aider.main.os.chdir")
|
||||||
@patch('aider.main.InputOutput')
|
@patch("aider.main.InputOutput")
|
||||||
def test_setup_git_home_new_project(self, mock_io, mock_chdir, mock_glob, mock_home):
|
def test_setup_git_home_new_project(self, mock_io, mock_chdir, mock_glob, mock_home):
|
||||||
mock_home.return_value = Path('/home/user')
|
mock_home.return_value = Path("/home/user")
|
||||||
mock_glob.return_value = [Path('/home/user/repo1/.git'), Path('/home/user/repo2/.git')]
|
mock_glob.return_value = [Path("/home/user/repo1/.git"), Path("/home/user/repo2/.git")]
|
||||||
mock_io.return_value.prompt_ask.return_value = 'new_project'
|
mock_io.return_value.prompt_ask.return_value = "new_project"
|
||||||
|
|
||||||
result = setup_git_home(mock_io.return_value)
|
result = setup_git_home(mock_io.return_value)
|
||||||
|
|
||||||
mock_io.return_value.tool_output.assert_called_with("Found git repositories in your home directory:")
|
mock_io.return_value.tool_output.assert_called_with(
|
||||||
|
"Found git repositories in your home directory:"
|
||||||
|
)
|
||||||
mock_io.return_value.prompt_ask.assert_called_once()
|
mock_io.return_value.prompt_ask.assert_called_once()
|
||||||
mock_chdir.assert_called_once_with(Path('/home/user/new_project'))
|
mock_chdir.assert_called_once_with(Path("/home/user/new_project"))
|
||||||
self.assertEqual(result, str(Path('/home/user/new_project')))
|
self.assertEqual(result, str(Path("/home/user/new_project")))
|
||||||
|
|
||||||
@patch('aider.main.Path.home')
|
@patch("aider.main.Path.home")
|
||||||
@patch('aider.main.Path.glob')
|
@patch("aider.main.Path.glob")
|
||||||
@patch('aider.main.os.chdir')
|
@patch("aider.main.os.chdir")
|
||||||
@patch('aider.main.InputOutput')
|
@patch("aider.main.InputOutput")
|
||||||
def test_setup_git_home_no_existing_repos(self, mock_io, mock_chdir, mock_glob, mock_home):
|
def test_setup_git_home_no_existing_repos(self, mock_io, mock_chdir, mock_glob, mock_home):
|
||||||
mock_home.return_value = Path('/home/user')
|
mock_home.return_value = Path("/home/user")
|
||||||
mock_glob.return_value = []
|
mock_glob.return_value = []
|
||||||
mock_io.return_value.user_input.return_value = 'new_project'
|
mock_io.return_value.user_input.return_value = "new_project"
|
||||||
|
|
||||||
result = setup_git_home(mock_io.return_value)
|
result = setup_git_home(mock_io.return_value)
|
||||||
|
|
||||||
mock_io.return_value.tool_output.assert_not_called()
|
mock_io.return_value.tool_output.assert_not_called()
|
||||||
mock_io.return_value.user_input.assert_called_once_with("Enter a name for your new project directory:")
|
mock_io.return_value.user_input.assert_called_once_with(
|
||||||
mock_chdir.assert_called_once_with(Path('/home/user/new_project'))
|
"Enter a name for your new project directory:"
|
||||||
self.assertEqual(result, str(Path('/home/user/new_project')))
|
)
|
||||||
|
mock_chdir.assert_called_once_with(Path("/home/user/new_project"))
|
||||||
|
self.assertEqual(result, str(Path("/home/user/new_project")))
|
||||||
|
|
||||||
def test_main_with_git_config_yml(self):
|
def test_main_with_git_config_yml(self):
|
||||||
make_repo()
|
make_repo()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue