mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 04:14:59 +00:00
test: Assert specific stderr messages for invalid edit format
This commit is contained in:
parent
6b9045a2a2
commit
57020a2d5e
1 changed files with 4 additions and 1 deletions
|
@ -950,7 +950,7 @@ class TestMain(TestCase):
|
|||
def test_invalid_edit_format(self):
|
||||
with GitTemporaryDirectory():
|
||||
# Suppress stderr for this test as argparse prints an error message
|
||||
with patch("sys.stderr", new_callable=StringIO):
|
||||
with patch("sys.stderr", new_callable=StringIO) as mock_stderr:
|
||||
with self.assertRaises(SystemExit) as cm:
|
||||
_ = main(
|
||||
["--edit-format", "not-a-real-format", "--exit", "--yes"],
|
||||
|
@ -959,6 +959,9 @@ class TestMain(TestCase):
|
|||
)
|
||||
# argparse.ArgumentParser.exit() is called with status 2 for invalid choice
|
||||
self.assertEqual(cm.exception.code, 2)
|
||||
stderr_output = mock_stderr.getvalue()
|
||||
self.assertIn("invalid choice", stderr_output)
|
||||
self.assertIn("not-a-real-format", stderr_output)
|
||||
|
||||
def test_default_model_selection(self):
|
||||
with GitTemporaryDirectory():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue