@@ -1390,111 +1390,70 @@ async def test_architect_coder_auto_accept_true(self):
13901390 io = InputOutput (yes = True )
13911391 io .confirm_ask = AsyncMock (return_value = False )
13921392
1393- with patch ("aider.coders.architect_coder.AskCoder.__init__" , return_value = None ):
1394- from aider .coders .architect_coder import ArchitectCoder
1395-
1396- coder = ArchitectCoder ()
1397- coder .io = io
1398- coder .main_model = self .GPT35
1399- coder .args = MagicMock (tweak_responses = False )
1400- coder .auto_accept_architect = True
1401- coder .verbose = False
1402- coder .total_cost = 0
1403- coder .cur_messages = []
1404- coder .done_messages = []
1405- coder .aider_commit_hashes = []
1406- coder .summarizer = MagicMock ()
1407- coder .summarizer .too_big .return_value = False
1408-
1409- mock_editor = MagicMock ()
1410- mock_editor .generate = AsyncMock ()
1411- mock_editor .total_cost = 0
1412- mock_editor .aider_commit_hashes = []
1413- with patch (
1414- "aider.coders.architect_coder.Coder.create" ,
1415- new_callable = AsyncMock ,
1416- return_value = mock_editor ,
1417- ):
1418- coder .partial_response_content = "Make these changes to the code"
1419-
1420- with pytest .raises (SwitchCoder ):
1421- await coder .reply_completed ()
1422-
1423- io .confirm_ask .assert_called_once_with (
1424- "Edit the files?" , allow_tweak = False
1425- )
1426- mock_editor .generate .assert_called_once ()
1393+ coder = await Coder .create (self .GPT35 , edit_format = "architect" , io = io )
1394+ coder .auto_accept_architect = True
1395+ coder .partial_response_content = "Make these changes to the code"
1396+
1397+ mock_editor = MagicMock ()
1398+ mock_editor .generate = AsyncMock ()
1399+ mock_editor .total_cost = 0
1400+ mock_editor .aider_commit_hashes = []
1401+
1402+ with patch (
1403+ "aider.coders.architect_coder.Coder.create" ,
1404+ new_callable = AsyncMock ,
1405+ return_value = mock_editor ,
1406+ ):
1407+ with pytest .raises (SwitchCoder ):
1408+ await coder .reply_completed ()
1409+
1410+ io .confirm_ask .assert_called_once_with ("Edit the files?" , allow_tweak = False )
1411+ mock_editor .generate .assert_called_once ()
14271412
14281413 async def test_architect_coder_auto_accept_false_confirmed (self ):
14291414 with GitTemporaryDirectory ():
14301415 io = InputOutput (yes = False )
14311416 io .confirm_ask = AsyncMock (return_value = True )
14321417
1433- with patch ("aider.coders.architect_coder.AskCoder.__init__" , return_value = None ):
1434- from aider .coders .architect_coder import ArchitectCoder
1435-
1436- coder = ArchitectCoder ()
1437- coder .io = io
1438- coder .main_model = self .GPT35
1439- coder .args = MagicMock (tweak_responses = False )
1440- coder .auto_accept_architect = False
1441- coder .verbose = False
1442- coder .total_cost = 0
1443- coder .cur_messages = []
1444- coder .done_messages = []
1445- coder .aider_commit_hashes = []
1446- coder .summarizer = MagicMock ()
1447- coder .summarizer .too_big .return_value = False
1448-
1449- mock_editor = MagicMock ()
1450- mock_editor .generate = AsyncMock ()
1451- mock_editor .total_cost = 0
1452- mock_editor .aider_commit_hashes = []
1453- with patch (
1454- "aider.coders.architect_coder.Coder.create" ,
1455- new_callable = AsyncMock ,
1456- return_value = mock_editor ,
1457- ):
1458- coder .partial_response_content = "Make these changes to the code"
1459-
1460- with pytest .raises (SwitchCoder ):
1461- await coder .reply_completed ()
1462-
1463- io .confirm_ask .assert_called_once_with (
1464- "Edit the files?" , allow_tweak = False
1465- )
1466- mock_editor .generate .assert_called_once ()
1418+ coder = await Coder .create (self .GPT35 , edit_format = "architect" , io = io )
1419+ coder .auto_accept_architect = False
1420+ coder .partial_response_content = "Make these changes to the code"
1421+
1422+ mock_editor = MagicMock ()
1423+ mock_editor .generate = AsyncMock ()
1424+ mock_editor .total_cost = 0
1425+ mock_editor .aider_commit_hashes = []
1426+
1427+ with patch (
1428+ "aider.coders.architect_coder.Coder.create" ,
1429+ new_callable = AsyncMock ,
1430+ return_value = mock_editor ,
1431+ ):
1432+ with pytest .raises (SwitchCoder ):
1433+ await coder .reply_completed ()
1434+
1435+ io .confirm_ask .assert_called_once_with ("Edit the files?" , allow_tweak = False )
1436+ mock_editor .generate .assert_called_once ()
14671437
14681438 async def test_architect_coder_auto_accept_false_rejected (self ):
14691439 with GitTemporaryDirectory ():
14701440 io = InputOutput (yes = False )
14711441 io .confirm_ask = AsyncMock (return_value = False )
14721442
1473- with patch ("aider.coders.architect_coder.AskCoder.__init__" , return_value = None ):
1474- from aider .coders .architect_coder import ArchitectCoder
1475-
1476- coder = ArchitectCoder ()
1477- coder .io = io
1478- coder .main_model = self .GPT35
1479- coder .args = MagicMock (tweak_responses = False )
1480- coder .auto_accept_architect = False
1481- coder .verbose = False
1482- coder .total_cost = 0
1483-
1484- mock_create = AsyncMock ()
1485- with patch (
1486- "aider.coders.architect_coder.Coder.create" ,
1487- mock_create ,
1488- ):
1489- coder .partial_response_content = "Make these changes to the code"
1490-
1491- result = await coder .reply_completed ()
1492-
1493- assert result is None
1494- io .confirm_ask .assert_called_once_with (
1495- "Edit the files?" , allow_tweak = False
1496- )
1497- mock_create .assert_not_called ()
1443+ coder = await Coder .create (self .GPT35 , edit_format = "architect" , io = io )
1444+ coder .auto_accept_architect = False
1445+ coder .partial_response_content = "Make these changes to the code"
1446+
1447+ mock_create = AsyncMock ()
1448+ with patch (
1449+ "aider.coders.architect_coder.Coder.create" ,
1450+ mock_create ,
1451+ ):
1452+ result = await coder .reply_completed ()
1453+
1454+ assert result is None
1455+ io .confirm_ask .assert_called_once_with ("Edit the files?" , allow_tweak = False )
1456+ mock_create .assert_not_called ()
14981457
14991458 @patch ("aider.coders.base_coder.experimental_mcp_client" )
15001459 async def test_mcp_server_connection (self , mock_mcp_client ):
0 commit comments