mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 16:25:00 +00:00
finish repo map fixture test
This commit is contained in:
parent
c38d482db3
commit
f5e27cee8a
2 changed files with 59 additions and 2 deletions
|
@ -442,14 +442,16 @@ class TestRepoMapAllLanguages(unittest.TestCase):
|
|||
io = InputOutput()
|
||||
repomap_root = Path(__file__).parent.parent.parent
|
||||
repo_map = RepoMap(
|
||||
main_model=self.GPT35, root=str(sample_code_base), io=io, repomap_root=str(repomap_root)
|
||||
main_model=self.GPT35,
|
||||
root=str(repomap_root),
|
||||
io=io,
|
||||
)
|
||||
|
||||
# Get all files in the sample code base
|
||||
other_files = [str(f) for f in sample_code_base.rglob("*") if f.is_file()]
|
||||
|
||||
# Generate the repo map
|
||||
generated_map_str = repo_map.get_repo_map([], other_files)
|
||||
generated_map_str = repo_map.get_repo_map([], other_files).strip()
|
||||
|
||||
# Read the expected map from the file
|
||||
with open(expected_map_file, "r") as f:
|
||||
|
|
55
tests/fixtures/sample-code-base-repo-map.txt
vendored
Normal file
55
tests/fixtures/sample-code-base-repo-map.txt
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
|
||||
tests/fixtures/sample-code-base/sample.js:
|
||||
⋮...
|
||||
│function greet(name) {
|
||||
│ return `Hello, ${name}!`;
|
||||
⋮...
|
||||
│function calculateCircleArea(radius) {
|
||||
│ return Math.PI * radius * radius;
|
||||
⋮...
|
||||
│function isPrime(number) {
|
||||
│ if (number <= 1) return false;
|
||||
│ for (let i = 2; i <= Math.sqrt(number); i++) {
|
||||
│ if (number % i === 0) return false;
|
||||
│ }
|
||||
│ return true;
|
||||
⋮...
|
||||
│function reverseString(str) {
|
||||
│ return str.split('').reverse().join('');
|
||||
⋮...
|
||||
│function getRandomNumber(min, max) {
|
||||
│ return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
⋮...
|
||||
│function filterEvenNumbers(numbers) {
|
||||
│ return numbers.filter(num => num % 2 !== 0);
|
||||
⋮...
|
||||
│function factorial(n) {
|
||||
│ if (n === 0 || n === 1) return 1;
|
||||
│ return n * factorial(n - 1);
|
||||
⋮...
|
||||
|
||||
tests/fixtures/sample-code-base/sample.py:
|
||||
│class Car:
|
||||
│ def __init__(self, make, model, year):
|
||||
│ self.make = make
|
||||
│ self.model = model
|
||||
│ self.year = year
|
||||
⋮...
|
||||
│ def accelerate(self, increment):
|
||||
⋮...
|
||||
│ def brake(self, decrement):
|
||||
⋮...
|
||||
│ def honk(self):
|
||||
⋮...
|
||||
│class Garage:
|
||||
│ def __init__(self):
|
||||
⋮...
|
||||
│ def add_car(self, car):
|
||||
⋮...
|
||||
│ def remove_car(self, car):
|
||||
⋮...
|
||||
│ def list_cars(self):
|
||||
⋮...
|
||||
│def main():
|
||||
⋮...
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue