forked from Aider-AI/aider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_special.py
76 lines (60 loc) · 1.89 KB
/
test_special.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import os
import pytest
from aider.special import filter_important_files, is_important
def test_is_important():
# Test common important files
assert is_important("README.md")
assert is_important(".gitignore")
assert is_important("requirements.txt")
assert is_important("setup.py")
# Test files in .github/workflows
assert is_important(os.path.join(".github", "workflows", "test.yml"))
assert is_important(os.path.join(".github", "workflows", "deploy.yml"))
# Test files that should not be considered important
assert not is_important("random_file.txt")
assert not is_important("src/main.py")
assert not is_important("tests/test_app.py")
def test_filter_important_files():
files = [
"README.md",
"src/main.py",
".gitignore",
"tests/test_app.py",
"requirements.txt",
".github/workflows/test.yml",
"random_file.txt",
]
important_files = filter_important_files(files)
assert set(important_files) == {
"README.md",
".gitignore",
"requirements.txt",
".github/workflows/test.yml",
}
def test_is_important_case_sensitivity():
# Test case sensitivity
assert is_important("README.md")
assert not is_important("readme.md")
assert is_important(".gitignore")
assert not is_important(".GITIGNORE")
def test_is_important_with_paths():
# Test with different path formats
assert not is_important("project/README.md")
assert is_important("./README.md")
assert not is_important("/absolute/path/to/README.md")
@pytest.mark.parametrize(
"file_path",
[
"README",
"README.txt",
"README.rst",
"LICENSE",
"LICENSE.md",
"LICENSE.txt",
"Dockerfile",
"package.json",
"pyproject.toml",
],
)
def test_is_important_various_files(file_path):
assert is_important(file_path)