fix: Handle new file creation in the same folder

This commit is contained in:
Nikolay Sedelnikov 2024-08-30 15:52:05 +02:00 committed by Nikolay Sedelnikov (aider)
parent 301c4265b7
commit e8e1bd556f
No known key found for this signature in database
GPG key ID: BA786963302B556C
2 changed files with 46 additions and 1 deletions

View file

@ -456,6 +456,43 @@ Hope you like it!
],
)
def test_new_file_created_in_same_folder(self):
edit = """
Here's the change:
path/to/a/file2.txt
```python
<<<<<<< SEARCH
=======
three
>>>>>>> REPLACE
```
another change
path/to/a/file1.txt
```python
<<<<<<< SEARCH
one
=======
two
>>>>>>> REPLACE
```
Hope you like it!
"""
edits = list(
eb.find_original_update_blocks(edit, valid_fnames=["path/to/a/file1.txt"])
)
self.assertEqual(
edits,
[
("path/to/a/file2.txt", "", "three\n"),
("path/to/a/file1.txt", "one\n", "two\n"),
],
)
if __name__ == "__main__":
unittest.main()