mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-23 05:45:00 +00:00
restore test_cmd_tokens
This commit is contained in:
parent
fd6ceb167c
commit
77f8be10b1
1 changed files with 26 additions and 0 deletions
|
@ -1,7 +1,9 @@
|
||||||
import codecs
|
import codecs
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from io import StringIO
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
|
@ -176,3 +178,27 @@ class TestCommands(TestCase):
|
||||||
repo = git.Repo(tempdir)
|
repo = git.Repo(tempdir)
|
||||||
files_in_repo = repo.git.ls_files()
|
files_in_repo = repo.git.ls_files()
|
||||||
self.assertIn("test.txt", files_in_repo)
|
self.assertIn("test.txt", files_in_repo)
|
||||||
|
|
||||||
|
def test_cmd_tokens(self):
|
||||||
|
# Initialize the Commands and InputOutput objects
|
||||||
|
io = InputOutput(pretty=False, yes=True)
|
||||||
|
|
||||||
|
coder = Coder.create(models.GPT35, None, io)
|
||||||
|
commands = Commands(io, coder)
|
||||||
|
|
||||||
|
commands.cmd_add("foo.txt bar.txt")
|
||||||
|
|
||||||
|
# Redirect the standard output to an instance of io.StringIO
|
||||||
|
stdout = StringIO()
|
||||||
|
sys.stdout = stdout
|
||||||
|
|
||||||
|
commands.cmd_tokens("")
|
||||||
|
|
||||||
|
# Reset the standard output
|
||||||
|
sys.stdout = sys.__stdout__
|
||||||
|
|
||||||
|
# Get the console output
|
||||||
|
console_output = stdout.getvalue()
|
||||||
|
|
||||||
|
self.assertIn("foo.txt", console_output)
|
||||||
|
self.assertIn("bar.txt", console_output)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue