refactor(files): remove redundant edit and snapshot state
This commit is contained in:
1 parent
721cc4e23f
commit
51884a244e
6 files changed
+47
-61
No files matched your search
@@ -141,11 +141,11 @@ def test_apply_patch_edits_add_to_existing_crlf_file_without_final_newline(tmp_p
|
||||
assert target.read_bytes() == b"alpha\r\nbravo\r\ncharlie\r\n"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("existing", [False, True], ids=["new-file", "existing-crlf"])
|
||||
def test_apply_patch_replaces_text_from_an_earlier_edit_in_the_batch(tmp_path, existing):
|
||||
@pytest.mark.parametrize("original", [None, b"", b"alpha\r\nbravo"], ids=["new", "empty", "crlf"])
|
||||
def test_apply_patch_replaces_text_from_an_earlier_edit_in_the_batch(tmp_path, original):
|
||||
target = tmp_path / "notes.txt"
|
||||
if existing:
|
||||
target.write_bytes(b"alpha\r\nbravo")
|
||||
if original is not None:
|
||||
target.write_bytes(original)
|
||||
tool = ApplyPatchTool(workspace=tmp_path)
|
||||
|
||||
result = asyncio.run(tool.execute(edits=[
|
||||
@@ -155,8 +155,8 @@ def test_apply_patch_replaces_text_from_an_earlier_edit_in_the_batch(tmp_path, e
|
||||
|
||||
assert result.startswith("Patch applied:\n")
|
||||
assert result.count("notes.txt") == 1
|
||||
assert f"{'update' if existing else 'add'} notes.txt" in result
|
||||
assert target.read_bytes() == (b"alpha\r\nbravo\r\ndelta\r\n" if existing else b"delta\n")
|
||||
assert f"{'add' if original is None else 'update'} notes.txt" in result
|
||||
assert target.read_bytes() == (b"alpha\r\nbravo\r\ndelta\r\n" if original else b"delta\n")
|
||||
|
||||
|
||||
def test_apply_patch_rejects_delete_action(tmp_path):
|
||||
|
||||
Reference in new issue
Block a user