mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 08:14:59 +00:00
updated tests
This commit is contained in:
parent
1b57a395d2
commit
56f6f74832
1 changed files with 17 additions and 22 deletions
|
@ -1,7 +1,6 @@
|
|||
import os
|
||||
import tempfile
|
||||
import unittest
|
||||
from subprocess import CompletedProcess
|
||||
from unittest.mock import patch
|
||||
|
||||
from aider.repomap import RepoMap
|
||||
|
@ -85,29 +84,25 @@ print(my_function(3, 4))
|
|||
with patch("subprocess.run") as mock_run:
|
||||
mock_run.side_effect = Exception("ctags not found")
|
||||
repo_map = RepoMap()
|
||||
result = repo_map.check_for_ctags()
|
||||
self.assertFalse(result)
|
||||
self.assertFalse(repo_map.has_ctags)
|
||||
|
||||
from unittest.mock import patch, MagicMock
|
||||
from subprocess import CompletedProcess
|
||||
def test_check_for_ctags_success(self):
|
||||
with patch("subprocess.check_output") as mock_run:
|
||||
mock_run.side_effect = [
|
||||
(
|
||||
b"Universal Ctags 0.0.0(f25b4bb7)\n Optional compiled features: +wildcards,"
|
||||
b" +regex, +gnulib_fnmatch, +gnulib_regex, +iconv, +option-directory, +xpath,"
|
||||
b" +json, +interactive, +yaml, +case-insensitive-filenames, +packcc,"
|
||||
b" +optscript, +pcre2"
|
||||
),
|
||||
(
|
||||
b'{"_type": "tag", "name": "status", "path": "aider/main.py", "pattern": "/^ '
|
||||
b' status = main()$/", "kind": "variable"}'
|
||||
),
|
||||
]
|
||||
repo_map = RepoMap()
|
||||
self.assertTrue(repo_map.has_ctags)
|
||||
|
||||
def test_check_for_ctags_success(self):
|
||||
with patch("subprocess.run") as mock_run:
|
||||
mock_run.side_effect = [
|
||||
CompletedProcess(
|
||||
args=["ctags", "--version"],
|
||||
returncode=0,
|
||||
stdout=b"Universal Ctags 0.0.0(f25b4bb7)",
|
||||
),
|
||||
CompletedProcess(
|
||||
args=["ctags", "-R"],
|
||||
returncode=0,
|
||||
stdout=b"",
|
||||
),
|
||||
]
|
||||
repo_map = RepoMap()
|
||||
result = repo_map.check_for_ctags()
|
||||
self.assertTrue(result)
|
||||
def test_get_repo_map_without_ctags(self):
|
||||
# Create a temporary directory with a sample Python file containing identifiers
|
||||
test_files = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue