test: update sanity_check_models_bogus_editor to expect two warnings

This commit is contained in:
Paul Gauthier (aider) 2024-10-02 11:21:13 -07:00
parent 97d6b68613
commit 875fb3a178

View file

@ -69,14 +69,11 @@ class TestModels(unittest.TestCase):
result = sanity_check_models(mock_io, main_model) result = sanity_check_models(mock_io, main_model)
self.assertTrue( self.assertTrue(result) # Should return True because there's a problem with the editor model
result mock_io.tool_warning.assert_called_with(ANY) # Ensure a warning was issued
) # Should return True because there's a problem with the editor model self.assertEqual(mock_io.tool_warning.call_count, 2) # Expect two warnings
mock_io.tool_warning.assert_called_once() # Ensure a warning was issued warning_messages = [call.args[0] for call in mock_io.tool_warning.call_args_list]
warning_message = mock_io.tool_warning.call_args[0][0] self.assertTrue(any("bogus-model" in msg for msg in warning_messages)) # Check that one of the warnings mentions the bogus model
self.assertIn(
"bogus-model", warning_message
) # Check that the warning mentions the bogus model
if __name__ == "__main__": if __name__ == "__main__":