mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 12:24:59 +00:00
test: update code_theme tests to check InputOutput initialization
This commit is contained in:
parent
d1384e9d5f
commit
fa49ab09c4
1 changed files with 17 additions and 17 deletions
|
@ -272,23 +272,23 @@ class TestMain(TestCase):
|
||||||
self.assertEqual(args[1], None)
|
self.assertEqual(args[1], None)
|
||||||
|
|
||||||
def test_dark_mode_sets_code_theme(self):
|
def test_dark_mode_sets_code_theme(self):
|
||||||
# Mock Coder.create to capture the configuration
|
# Mock InputOutput to capture the configuration
|
||||||
with patch("aider.coders.Coder.create") as MockCoder:
|
with patch("aider.main.InputOutput") as MockInputOutput:
|
||||||
main(["--dark-mode", "--no-git"], input=DummyInput(), output=DummyOutput())
|
main(["--dark-mode", "--no-git"], input=DummyInput(), output=DummyOutput())
|
||||||
# Ensure Coder.create was called
|
# Ensure InputOutput was called
|
||||||
MockCoder.assert_called_once()
|
MockInputOutput.assert_called_once()
|
||||||
# Check if the code_theme setting is for dark mode
|
# Check if the code_theme setting is for dark mode
|
||||||
_, kwargs = MockCoder.call_args
|
_, kwargs = MockInputOutput.call_args
|
||||||
self.assertEqual(kwargs["code_theme"], "monokai")
|
self.assertEqual(kwargs["code_theme"], "monokai")
|
||||||
|
|
||||||
def test_light_mode_sets_code_theme(self):
|
def test_light_mode_sets_code_theme(self):
|
||||||
# Mock Coder.create to capture the configuration
|
# Mock InputOutput to capture the configuration
|
||||||
with patch("aider.coders.Coder.create") as MockCoder:
|
with patch("aider.main.InputOutput") as MockInputOutput:
|
||||||
main(["--light-mode", "--no-git"], input=DummyInput(), output=DummyOutput())
|
main(["--light-mode", "--no-git"], input=DummyInput(), output=DummyOutput())
|
||||||
# Ensure Coder.create was called
|
# Ensure InputOutput was called
|
||||||
MockCoder.assert_called_once()
|
MockInputOutput.assert_called_once()
|
||||||
# Check if the code_theme setting is for light mode
|
# Check if the code_theme setting is for light mode
|
||||||
_, kwargs = MockCoder.call_args
|
_, kwargs = MockInputOutput.call_args
|
||||||
self.assertEqual(kwargs["code_theme"], "default")
|
self.assertEqual(kwargs["code_theme"], "default")
|
||||||
|
|
||||||
def create_env_file(self, file_name, content):
|
def create_env_file(self, file_name, content):
|
||||||
|
@ -298,25 +298,25 @@ class TestMain(TestCase):
|
||||||
|
|
||||||
def test_env_file_flag_sets_automatic_variable(self):
|
def test_env_file_flag_sets_automatic_variable(self):
|
||||||
env_file_path = self.create_env_file(".env.test", "AIDER_DARK_MODE=True")
|
env_file_path = self.create_env_file(".env.test", "AIDER_DARK_MODE=True")
|
||||||
with patch("aider.coders.Coder.create") as MockCoder:
|
with patch("aider.main.InputOutput") as MockInputOutput:
|
||||||
main(
|
main(
|
||||||
["--env-file", str(env_file_path), "--no-git"],
|
["--env-file", str(env_file_path), "--no-git"],
|
||||||
input=DummyInput(),
|
input=DummyInput(),
|
||||||
output=DummyOutput(),
|
output=DummyOutput(),
|
||||||
)
|
)
|
||||||
MockCoder.assert_called_once()
|
MockInputOutput.assert_called_once()
|
||||||
# Check if the color settings are for dark mode
|
# Check if the color settings are for dark mode
|
||||||
_, kwargs = MockCoder.call_args
|
_, kwargs = MockInputOutput.call_args
|
||||||
self.assertEqual(kwargs["code_theme"], "monokai")
|
self.assertEqual(kwargs["code_theme"], "monokai")
|
||||||
|
|
||||||
def test_default_env_file_sets_automatic_variable(self):
|
def test_default_env_file_sets_automatic_variable(self):
|
||||||
self.create_env_file(".env", "AIDER_DARK_MODE=True")
|
self.create_env_file(".env", "AIDER_DARK_MODE=True")
|
||||||
with patch("aider.coders.Coder.create") as MockCoder:
|
with patch("aider.main.InputOutput") as MockInputOutput:
|
||||||
main(["--no-git"], input=DummyInput(), output=DummyOutput())
|
main(["--no-git"], input=DummyInput(), output=DummyOutput())
|
||||||
# Ensure Coder.create was called
|
# Ensure InputOutput was called
|
||||||
MockCoder.assert_called_once()
|
MockInputOutput.assert_called_once()
|
||||||
# Check if the color settings are for dark mode
|
# Check if the color settings are for dark mode
|
||||||
_, kwargs = MockCoder.call_args
|
_, kwargs = MockInputOutput.call_args
|
||||||
self.assertEqual(kwargs["code_theme"], "monokai")
|
self.assertEqual(kwargs["code_theme"], "monokai")
|
||||||
|
|
||||||
def test_false_vals_in_env_file(self):
|
def test_false_vals_in_env_file(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue