Add unit test to verify cmd_lint calls linter with correct filename

This commit is contained in:
Paul Gauthier 2024-07-30 10:10:37 -03:00 committed by Paul Gauthier (aider)
parent 167abdf851
commit 33d9f46e25

View file

@ -742,8 +742,10 @@ class TestCommands(TestCase):
# Run cmd_lint
commands.cmd_lint()
# Check if the linter was called with the dirty file
mock_lint.assert_called_once_with(Path(filename).name)
# Check if the linter was called with a filename string whose Path().name matches the expected filename
mock_lint.assert_called_once()
called_arg = mock_lint.call_args[0][0]
self.assertEqual(Path(called_arg).name, filename)
# Verify that the file is still dirty after linting
self.assertTrue(repo.is_dirty(filename))