Co-authored-by: Bastien <bastien.baret@gmail.com>
Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai>
Co-authored-by: Julien Legrand <72564015+JulienLGRD@users.noreply.github.com>
Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com>
Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai>
Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai>
Co-authored-by: Quentin <quentin.torroba@mistral.ai>
Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Clément Drouin 2026-04-14 10:33:15 +02:00 committed by GitHub
parent e9a9217cc8
commit e1a25caa52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
85 changed files with 2830 additions and 594 deletions

View file

@ -25,7 +25,7 @@ class TestEdit:
def test_returns_modified_content(self) -> None:
with patch.dict("os.environ", {"VISUAL": "vim"}, clear=True):
with patch("subprocess.run") as mock_run:
with patch("pathlib.Path.read_text", return_value="modified"):
with patch("pathlib.Path.read_bytes", return_value=b"modified"):
with patch("pathlib.Path.unlink"):
editor = ExternalEditor()
result = editor.edit("original")
@ -35,7 +35,7 @@ class TestEdit:
def test_returns_none_when_content_unchanged(self) -> None:
with patch.dict("os.environ", {"VISUAL": "vim"}, clear=True):
with patch("subprocess.run"):
with patch("pathlib.Path.read_text", return_value="same"):
with patch("pathlib.Path.read_bytes", return_value=b"same"):
with patch("pathlib.Path.unlink"):
editor = ExternalEditor()
result = editor.edit("same")
@ -44,7 +44,7 @@ class TestEdit:
def test_strips_trailing_whitespace(self) -> None:
with patch.dict("os.environ", {"VISUAL": "vim"}, clear=True):
with patch("subprocess.run"):
with patch("pathlib.Path.read_text", return_value="content\n\n"):
with patch("pathlib.Path.read_bytes", return_value=b"content\n\n"):
with patch("pathlib.Path.unlink"):
editor = ExternalEditor()
result = editor.edit("original")
@ -53,7 +53,7 @@ class TestEdit:
def test_handles_editor_with_args(self) -> None:
with patch.dict("os.environ", {"VISUAL": "code --wait"}, clear=True):
with patch("subprocess.run") as mock_run:
with patch("pathlib.Path.read_text", return_value="edited"):
with patch("pathlib.Path.read_bytes", return_value=b"edited"):
with patch("pathlib.Path.unlink"):
editor = ExternalEditor()
editor.edit("original")