mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-22 05:14:59 +00:00
added test for --encoding
This commit is contained in:
parent
ac9160ae54
commit
6791bc19c6
1 changed files with 17 additions and 2 deletions
|
@ -4,7 +4,7 @@ import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from unittest.mock import patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
import git
|
import git
|
||||||
from prompt_toolkit.input import DummyInput
|
from prompt_toolkit.input import DummyInput
|
||||||
|
@ -13,7 +13,7 @@ from prompt_toolkit.output import DummyOutput
|
||||||
from aider.dump import dump # noqa: F401
|
from aider.dump import dump # noqa: F401
|
||||||
from aider.io import InputOutput
|
from aider.io import InputOutput
|
||||||
from aider.main import check_gitignore, main, setup_git
|
from aider.main import check_gitignore, main, setup_git
|
||||||
from tests.utils import make_repo
|
from tests.utils import GitTemporaryDirectory, make_repo
|
||||||
|
|
||||||
|
|
||||||
class TestMain(TestCase):
|
class TestMain(TestCase):
|
||||||
|
@ -178,3 +178,18 @@ class TestMain(TestCase):
|
||||||
main(["--dirty-commits"], input=DummyInput())
|
main(["--dirty-commits"], input=DummyInput())
|
||||||
_, kwargs = MockCoder.call_args
|
_, kwargs = MockCoder.call_args
|
||||||
assert kwargs["dirty_commits"] is True
|
assert kwargs["dirty_commits"] is True
|
||||||
|
|
||||||
|
def test_encodings_arg(self):
|
||||||
|
fname = "foo.py"
|
||||||
|
|
||||||
|
with GitTemporaryDirectory():
|
||||||
|
with patch("aider.main.Coder.create") as MockCoder: # noqa: F841
|
||||||
|
with patch("aider.main.InputOutput") as MockSend:
|
||||||
|
|
||||||
|
def side_effect(*args, **kwargs):
|
||||||
|
self.assertEqual(kwargs["encoding"], "iso-8859-15")
|
||||||
|
return MagicMock()
|
||||||
|
|
||||||
|
MockSend.side_effect = side_effect
|
||||||
|
|
||||||
|
main(["--yes", fname, "--encoding", "iso-8859-15"])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue