def test_copy_operation_validates_target_path(editor: ArtifactEditorToolSpec):
    """Test that copy operations validate the target path."""
    editor.create_artifact(name="John", age=30, email="john@example.com")

    # Try to copy to an invalid field
    patch = JsonPatch(
        operations=[
            PatchOperation(op="copy", path="/invalid_field", from_path="/email")
        ]
    )

    with pytest.raises(ValueError, match="Invalid field 'invalid_field'"):
        editor.apply_patch(patch)
Test that copy operations validate the target path.
llama-index-integrations/tools/llama-index-tools-artifact-editor/tests/test_artifact_editor.py