aider/tests
Paul Gauthier 4373006137 aider: Added a test for AutoCompleter that passes in a non-existent file and checks that self.words is an empty set.
# Context:
USER: add a test for `AutoCompleter` that passes in a non-existant file. make sure self.words is empty.
ASSISTANT: To add a test for `AutoCompleter` that passes in a non-existent file, we need to modify the `tests/test_io.py` file. We will add a new test method `test_autocompleter_with_non_existent_file` in the `TestInputOutput` class.

Here is the change:

```python
tests/test_io.py
<<<<<<< ORIGINAL
import os
import unittest
from unittest.mock import patch

from aider.io import InputOutput

class TestInputOutput(unittest.TestCase):
    def test_no_color_environment_variable(self):
        with patch.dict(os.environ, {"NO_COLOR": "1"}):
            io = InputOutput()
            self.assertFalse(io.pretty)

if __name__ == "__main__":
    unittest.main()
=======
import os
import unittest
from unittest.mock import patch

from aider.io import InputOutput, AutoCompleter

class TestInputOutput(unittest.TestCase):
    def test_no_color_environment_variable(self):
        with patch.dict(os.environ, {"NO_COLOR": "1"}):
            io = InputOutput()
            self.assertFalse(io.pretty)

    def test_autocompleter_with_non_existent_file(self):
        root = ""
        rel_fnames = ["non_existent_file"]
        addable_rel_fnames = []
        commands = None
        autocompleter = AutoCompleter(root, rel_fnames, addable_rel_fnames, commands)
        self.assertEqual(autocompleter.words, set())

if __name__ == "__main__":
    unittest.main()
>>>>>>> UPDATED
```

This new test creates an instance of `AutoCompleter` with a non-existent file and checks that `self.words` is an empty set.
2023-07-04 12:37:23 -07:00
..
__init__.py aider: Added empty __init__.py file to tests directory to fix ModuleNotFoundError when running tests. 2023-05-11 17:12:42 -07:00
test_coder.py aider: Replaced MagicMock with custom mock_send function to set partial_response_content and return False in test_get_commit_message. 2023-06-21 21:39:47 -07:00
test_commands.py fixed test 2023-06-21 21:33:51 -07:00
test_editblock.py fix test after merge 2023-06-23 07:55:03 -07:00
test_io.py aider: Added a test for AutoCompleter that passes in a non-existent file and checks that self.words is an empty set. 2023-07-04 12:37:23 -07:00
test_main.py refac 2023-06-20 17:46:47 -07:00
test_models.py More Model test cases 2023-06-21 14:13:34 -07:00
test_repomap.py updated tests 2023-07-03 10:51:47 -07:00
test_wholefile.py added test for non-backtick fences 2023-06-25 20:47:17 -07:00