Commit 87cefe6
Paul Gauthier
aider: Add a test that cycles through all the
# Aider chat conversation:
USER: add a test that cycles through all the `PARSERS` values and does get_parser on them
ASSISTANT: To add a test that cycles through all the `PARSERS` values and calls `filename_to_lang` on them, we need to modify the `tests/test_parsers.py` file.
Here is the step-by-step process:
1. Import the `PARSERS` dictionary and `filename_to_lang` function from `parsers.py` in `test_parsers.py`.
2.
^C KeyboardInterrupt
USER: I added these *read-write* files: /Users/gauthier/Projects/grep-ast/grep_ast/grep_ast.py
ASSISTANT: To add a test that cycles through all the `PARSERS` values and calls `get_parser` on them, we need to modify the `tests/test_parsers.py` file.
Here is the step-by-step process:
1. Import the `PARSERS` dictionary and `get_parser` function from `parsers.py` in `test_parsers.py`.
2. Create a new test function, let's call it `test_get_parser_for_all_parsers`.
3. Inside this function, iterate over all the values in the `PARSERS` dictionary.
4. For each value, call the `get_parser` function and assert that it does not return `None`.
Here is the *SEARCH/REPLACE block* for the changes:
```python
tests/test_parsers.py
<<<<<<< SEARCH
=======
import pytest
from grep_ast.parsers import PARSERS, get_parser
def test_get_parser_for_all_parsers():
for lang in PARSERS.values():
assert get_parser(lang) is not None
>>>>>>> REPLACE
```
This test will fail if `get_parser` returns `None` for any language in the `PARSERS` dictionary, indicating that there is no parser available for that language.PARSERS values and calls get_parser on them.1 parent 07a5fe4 commit 87cefe6
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
0 commit comments