From 250d89649be678ede9fa8fda604f470511e97a1c Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 2 May 2024 13:01:41 -0700 Subject: [PATCH] added test coverage #585 --- aider/main.py | 2 +- tests/test_main.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/aider/main.py b/aider/main.py index f0bdb072a..1bba9cdd0 100644 --- a/aider/main.py +++ b/aider/main.py @@ -219,7 +219,7 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F args.assistant_output_color = "blue" args.code_theme = "default" - if return_coder: + if return_coder and args.yes is None: args.yes = True io = InputOutput( diff --git a/tests/test_main.py b/tests/test_main.py index dfcaaa8fb..d319a78dd 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -219,3 +219,21 @@ class TestMain(TestCase): main(["--message", test_message], input=DummyInput(), output=DummyOutput()) mock_io_instance.add_to_input_history.assert_called_once_with(test_message) + + @patch("aider.main.InputOutput") + @patch("aider.coders.base_coder.Coder.run") + def test_yes(self, mock_run, MockInputOutput): + test_message = "test message" + + main(["--yes", "--message", test_message]) + args, kwargs = MockInputOutput.call_args + self.assertTrue(args[1]) + + @patch("aider.main.InputOutput") + @patch("aider.coders.base_coder.Coder.run") + def test_default_yes(self, mock_run, MockInputOutput): + test_message = "test message" + + main(["--message", test_message]) + args, kwargs = MockInputOutput.call_args + self.assertEqual(args[1], None)