mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 12:24:59 +00:00
aider: Replaced the usage of create_pipe_input()
with create_input(StringIO(''))
in the test cases.
# Context: USER: try using create_input(StringIO('')) in the tests ASSISTANT: I understand that you want to use `create_input(StringIO(''))` in the tests. However, I need more information about which test cases you want to apply this change to and how you want to use it. Please provide more details or examples. USER: the ones that currently use create_pipe_input() ASSISTANT: I see that you want to replace `create_pipe_input()` with `create_input(StringIO(''))` in the test cases. Here are the changes for the `tests/test_main.py` file: ```python tests/test_main.py <<<<<<< ORIGINAL from prompt_toolkit.input import create_pipe_input ======= from prompt_toolkit.input import create_input from io import StringIO >>>>>>> UPDATED ``` ```python tests/test_main.py <<<<<<< ORIGINAL pipe_input = create_pipe_input() ======= pipe_input = create_input(StringIO('')) >>>>>>> UPDATED ``` ```python tests/test_main.py <<<<<<< ORIGINAL pipe_input = create_pipe_input() ======= pipe_input = create_input(StringIO('')) >>>>>>> UPDATED ``` ```python tests/test_main.py <<<<<<< ORIGINAL pipe_input = create_pipe_input() ======= pipe_input = create_input(StringIO('')) >>>>>>> UPDATED ``` These changes will replace the usage of `create_pipe_input()` with `create_input(StringIO(''))` in the test cases.
This commit is contained in:
parent
ac92ccac5c
commit
4bb043f5c0
1 changed files with 5 additions and 4 deletions
|
@ -4,7 +4,8 @@ import tempfile
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from aider.main import main
|
from aider.main import main
|
||||||
import subprocess
|
import subprocess
|
||||||
from prompt_toolkit.input import create_pipe_input
|
from prompt_toolkit.input import create_input
|
||||||
|
from io import StringIO
|
||||||
from prompt_toolkit.output import DummyOutput
|
from prompt_toolkit.output import DummyOutput
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +13,7 @@ class TestMain(TestCase):
|
||||||
def test_main_with_empty_dir_no_files_on_command(self):
|
def test_main_with_empty_dir_no_files_on_command(self):
|
||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
os.chdir(temp_dir)
|
os.chdir(temp_dir)
|
||||||
pipe_input = create_pipe_input()
|
pipe_input = create_input(StringIO(''))
|
||||||
save_stdin = sys.stdin
|
save_stdin = sys.stdin
|
||||||
sys.stdin = pipe_input
|
sys.stdin = pipe_input
|
||||||
main([], input=pipe_input, output=DummyOutput())
|
main([], input=pipe_input, output=DummyOutput())
|
||||||
|
@ -22,7 +23,7 @@ class TestMain(TestCase):
|
||||||
def test_main_with_empty_dir_new_file(self):
|
def test_main_with_empty_dir_new_file(self):
|
||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
os.chdir(temp_dir)
|
os.chdir(temp_dir)
|
||||||
pipe_input = create_pipe_input()
|
pipe_input = create_input(StringIO(''))
|
||||||
save_stdin = sys.stdin
|
save_stdin = sys.stdin
|
||||||
sys.stdin = pipe_input
|
sys.stdin = pipe_input
|
||||||
main(["foo.txt"], input=pipe_input, output=DummyOutput())
|
main(["foo.txt"], input=pipe_input, output=DummyOutput())
|
||||||
|
@ -34,7 +35,7 @@ class TestMain(TestCase):
|
||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
os.chdir(temp_dir)
|
os.chdir(temp_dir)
|
||||||
subprocess.run(["git", "init"], cwd=temp_dir)
|
subprocess.run(["git", "init"], cwd=temp_dir)
|
||||||
pipe_input = create_pipe_input()
|
pipe_input = create_input(StringIO(''))
|
||||||
save_stdin = sys.stdin
|
save_stdin = sys.stdin
|
||||||
sys.stdin = pipe_input
|
sys.stdin = pipe_input
|
||||||
main(["--yes", "foo.txt"], input=pipe_input, output=DummyOutput())
|
main(["--yes", "foo.txt"], input=pipe_input, output=DummyOutput())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue