mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 04:14:59 +00:00
test: Fix invalid edit format test assertion
This commit is contained in:
parent
b79052501d
commit
5f24a0013a
1 changed files with 5 additions and 8 deletions
|
@ -949,19 +949,16 @@ class TestMain(TestCase):
|
|||
|
||||
def test_invalid_edit_format(self):
|
||||
with GitTemporaryDirectory():
|
||||
with patch("aider.io.InputOutput.offer_url") as mock_offer_url:
|
||||
# Suppress stderr for this test as argparse prints an error message
|
||||
with patch("sys.stderr", new_callable=StringIO):
|
||||
# Suppress stderr for this test as argparse prints an error message
|
||||
with patch("sys.stderr", new_callable=StringIO):
|
||||
with self.assertRaises(SystemExit) as cm:
|
||||
result = main(
|
||||
["--edit-format", "not-a-real-format", "--exit", "--yes"],
|
||||
input=DummyInput(),
|
||||
output=DummyOutput(),
|
||||
)
|
||||
# main() should return 1 when argparse itself fails due to an invalid choice
|
||||
# (argparse exits with 2, which main converts to 1)
|
||||
self.assertEqual(result, 1)
|
||||
# offer_url not called: argparse handles error before aider's custom check
|
||||
mock_offer_url.assert_not_called()
|
||||
# argparse.ArgumentParser.exit() is called with status 2 for invalid choice
|
||||
self.assertEqual(cm.exception.code, 2)
|
||||
|
||||
def test_default_model_selection(self):
|
||||
with GitTemporaryDirectory():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue