mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 06:44:59 +00:00
aider: Switched open calls to use Path.write_text.
# Aider chat conversation: USER: also swith the open calls to use Path.write_text ASSISTANT: To switch the `open` calls to use `Path.write_text` in `test_cmd_add_drop_directory`, we need to modify the `tests/test_commands.py` file. Here are the changes: ```python tests/test_commands.py <<<<<<< ORIGINAL with open(Path("test_dir/test_file1.txt"), "w") as f: f.write("Test file 1") with open(Path("test_dir/test_file2.txt"), "w") as f: f.write("Test file 2") with open(Path("test_dir/another_dir/test_file.txt"), "w") as f: f.write("Test file 3") ======= Path("test_dir/test_file1.txt").write_text("Test file 1") Path("test_dir/test_file2.txt").write_text("Test file 2") Path("test_dir/another_dir/test_file.txt").write_text("Test file 3") >>>>>>> UPDATED ``` This change replaces the `open` calls with `Path().write_text()` from the pathlib module.
This commit is contained in:
parent
d695fe103b
commit
47b550c62f
1 changed files with 3 additions and 6 deletions
|
@ -93,12 +93,9 @@ class TestCommands(TestCase):
|
|||
# Create a directory and add files to it using pathlib
|
||||
Path("test_dir").mkdir()
|
||||
Path("test_dir/another_dir").mkdir()
|
||||
with open(Path("test_dir/test_file1.txt"), "w") as f:
|
||||
f.write("Test file 1")
|
||||
with open(Path("test_dir/test_file2.txt"), "w") as f:
|
||||
f.write("Test file 2")
|
||||
with open(Path("test_dir/another_dir/test_file.txt"), "w") as f:
|
||||
f.write("Test file 3")
|
||||
Path("test_dir/test_file1.txt").write_text("Test file 1")
|
||||
Path("test_dir/test_file2.txt").write_text("Test file 2")
|
||||
Path("test_dir/another_dir/test_file.txt").write_text("Test file 3")
|
||||
|
||||
# Call the cmd_add method with a directory
|
||||
commands.cmd_add("test_dir test_dir/test_file2.txt")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue