mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 06:44:59 +00:00
better /tokens test
This commit is contained in:
parent
eb6ac6841f
commit
5ec5b60660
1 changed files with 8 additions and 4 deletions
|
@ -1,12 +1,15 @@
|
||||||
import codecs
|
import codecs
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from io import StringIO
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
import io
|
|
||||||
|
|
||||||
from aider import models
|
from aider import models
|
||||||
|
from aider.coders import Coder
|
||||||
from aider.commands import Commands
|
from aider.commands import Commands
|
||||||
|
from aider.dump import dump # noqa: F401
|
||||||
from aider.io import InputOutput
|
from aider.io import InputOutput
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,7 +57,6 @@ class TestCommands(TestCase):
|
||||||
def test_cmd_tokens(self):
|
def test_cmd_tokens(self):
|
||||||
# Initialize the Commands and InputOutput objects
|
# Initialize the Commands and InputOutput objects
|
||||||
io = InputOutput(pretty=False, yes=True)
|
io = InputOutput(pretty=False, yes=True)
|
||||||
from aider.coders import Coder
|
|
||||||
|
|
||||||
coder = Coder.create(models.GPT35, None, io, openai_api_key="deadbeef")
|
coder = Coder.create(models.GPT35, None, io, openai_api_key="deadbeef")
|
||||||
commands = Commands(io, coder)
|
commands = Commands(io, coder)
|
||||||
|
@ -62,7 +64,7 @@ class TestCommands(TestCase):
|
||||||
commands.cmd_add("foo.txt bar.txt")
|
commands.cmd_add("foo.txt bar.txt")
|
||||||
|
|
||||||
# Redirect the standard output to an instance of io.StringIO
|
# Redirect the standard output to an instance of io.StringIO
|
||||||
stdout = io.StringIO()
|
stdout = StringIO()
|
||||||
sys.stdout = stdout
|
sys.stdout = stdout
|
||||||
|
|
||||||
commands.cmd_tokens("")
|
commands.cmd_tokens("")
|
||||||
|
@ -72,4 +74,6 @@ class TestCommands(TestCase):
|
||||||
|
|
||||||
# Get the console output
|
# Get the console output
|
||||||
console_output = stdout.getvalue()
|
console_output = stdout.getvalue()
|
||||||
print(console_output)
|
|
||||||
|
self.assertIn("foo.txt", console_output)
|
||||||
|
self.assertIn("bar.txt", console_output)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue