v2.17.0 (#822)
Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai> Co-authored-by: Guillaume LE GOFF <guillaume.lgf@gmail.com> Co-authored-by: Hdandria <henri.dandria@mistral.ai> Co-authored-by: Ivana Dunisijevic <ivana.dunisijevic@mistral.ai> Co-authored-by: Jean Burellier <sheplu@users.noreply.github.com> Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai> Co-authored-by: Mert Unsal <mert.unsal@mistral.ai> Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com> Co-authored-by: Paul VEZIA <166131032+le-codeur-rapide@users.noreply.github.com> Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai> Co-authored-by: Val <102326092+vdeva@users.noreply.github.com> Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com> Co-authored-by: renovate-mistral[bot] <253709520+renovate-mistral[bot]@users.noreply.github.com> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
564a14365e
commit
6bedf271ce
223 changed files with 10533 additions and 6947 deletions
|
|
@ -230,21 +230,21 @@ def test_get_result_display() -> None:
|
|||
assert "foo.py" in display.message
|
||||
|
||||
|
||||
def test_ui_start_line_not_part_of_model_contract() -> None:
|
||||
def test_ui_start_lines_not_part_of_model_contract() -> None:
|
||||
result = EditResult(file="/x", message="m", old_string="a", new_string="b")
|
||||
result._ui_start_line = 42
|
||||
result._ui_start_lines = [42]
|
||||
|
||||
assert result.ui_start_line == 42
|
||||
assert "ui_start_line" not in result.model_dump()
|
||||
assert "_ui_start_line" not in result.model_dump()
|
||||
assert "ui_start_line" not in result.model_dump_json()
|
||||
assert "ui_start_line" not in EditResult.model_fields
|
||||
assert "ui_start_line" not in EditResult.model_json_schema().get("properties", {})
|
||||
assert "ui_start_line" not in dict(result)
|
||||
assert result.ui_start_lines == [42]
|
||||
assert "ui_start_lines" not in result.model_dump()
|
||||
assert "_ui_start_lines" not in result.model_dump()
|
||||
assert "ui_start_lines" not in result.model_dump_json()
|
||||
assert "ui_start_lines" not in EditResult.model_fields
|
||||
assert "ui_start_lines" not in EditResult.model_json_schema().get("properties", {})
|
||||
assert "ui_start_lines" not in dict(result)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_ui_start_line_computed_at_edit_site(
|
||||
async def test_ui_start_lines_computed_at_edit_site(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
monkeypatch.chdir(tmp_path)
|
||||
|
|
@ -255,11 +255,11 @@ async def test_ui_start_line_computed_at_edit_site(
|
|||
edit.run(EditArgs(file_path="f.txt", old_string="gamma", new_string="GAMMA"))
|
||||
)
|
||||
|
||||
assert result.ui_start_line == 3
|
||||
assert result.ui_start_lines == [3]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_ui_start_line_set_for_pure_deletion(
|
||||
async def test_ui_start_lines_set_for_pure_deletion(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
monkeypatch.chdir(tmp_path)
|
||||
|
|
@ -270,4 +270,38 @@ async def test_ui_start_line_set_for_pure_deletion(
|
|||
edit.run(EditArgs(file_path="f.txt", old_string="remove\n", new_string=""))
|
||||
)
|
||||
|
||||
assert result.ui_start_line == 3
|
||||
assert result.ui_start_lines == [3]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_ui_start_lines_lists_all_occurrences_for_replace_all(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
monkeypatch.chdir(tmp_path)
|
||||
_write(tmp_path, "f.txt", "x\ntgt\ny\ntgt\nz\ntgt\n")
|
||||
edit = _make_edit()
|
||||
|
||||
result = await collect_result(
|
||||
edit.run(
|
||||
EditArgs(
|
||||
file_path="f.txt", old_string="tgt", new_string="TGT", replace_all=True
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
assert result.ui_start_lines == [2, 4, 6]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_ui_start_lines_single_entry_without_replace_all(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
monkeypatch.chdir(tmp_path)
|
||||
_write(tmp_path, "f.txt", "a\nuniq\nb\n")
|
||||
edit = _make_edit()
|
||||
|
||||
result = await collect_result(
|
||||
edit.run(EditArgs(file_path="f.txt", old_string="uniq", new_string="UNIQ"))
|
||||
)
|
||||
|
||||
assert result.ui_start_lines == [2]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue