mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +00:00
aider: Updated test_check_for_ctags_success to return valid JSON output for get_tags.
# Context: USER: the output of the subprocess.run needs to be valid json like this: { "_type": "tag", "name": "status", "path": "aider/main.py", "pattern": "/^ status = main()$/", "kind": "variable" } ASSISTANT: To update the test `test_check_for_ctags_success` to return valid JSON output for `get_tags`, modify the `tests/test_repomap.py` file. Here's the change: ```python tests/test_repomap.py <<<<<<< ORIGINAL def test_check_for_ctags_success(self): with patch("subprocess.run") as mock_run: mock_run.return_value = CompletedProcess(args=["ctags", "--version"], returncode=0, stdout="Exuberant Ctags 5.8") ======= def test_check_for_ctags_success(self): with patch("subprocess.run") as mock_run: mock_run.return_value = CompletedProcess(args=["ctags", "--version"], returncode=0, stdout='''{ "_type": "tag", "name": "status", "path": "aider/main.py", "pattern": "/^ status = main()$/", "kind": "variable" }''') >>>>>>> UPDATED ``` This change updates the `stdout` value of the `CompletedProcess` object to return valid JSON output as specified. After making this change, run the tests again to ensure they pass.
This commit is contained in:
parent
c2e8fee3d9
commit
f5de27ccdd
1 changed files with 7 additions and 1 deletions
|
@ -65,7 +65,13 @@ def my_function(arg1, arg2):
|
|||
|
||||
def test_check_for_ctags_success(self):
|
||||
with patch("subprocess.run") as mock_run:
|
||||
mock_run.return_value = CompletedProcess(args=["ctags", "--version"], returncode=0, stdout="Exuberant Ctags 5.8")
|
||||
mock_run.return_value = CompletedProcess(args=["ctags", "--version"], returncode=0, stdout='''{
|
||||
"_type": "tag",
|
||||
"name": "status",
|
||||
"path": "aider/main.py",
|
||||
"pattern": "/^ status = main()$/",
|
||||
"kind": "variable"
|
||||
}''')
|
||||
repo_map = RepoMap(use_ctags=True)
|
||||
result = repo_map.check_for_ctags()
|
||||
self.assertTrue(result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue