code: def test_delete_vm_by_id(patch_vsphere_sdk_provider):
      vsp = mock_vsphere_sdk_provider()
  
      vsp.vsphere_sdk_client.vcenter.vm.Power.stop = MagicMock()
  
      vsp.vsphere_sdk_client.vcenter.vm.Power.get.return_value = (
          HardPower.Info(state=HardPower.State.POWERED_ON)
      )
      vsp.delete_vm_by_id("vm2")
      vsp.vsphere_sdk_client.vcenter.vm.Power.stop.assert_called_once_with(
          "vm2"
      )
      vsp.vsphere_sdk_client.vcenter.VM.delete.assert_called_once_with(
          "vm2"
      )
  
file_path: ray/python/ray/tests/vsphere/test_vsphere_sdk_provider.py
imports: import pytest
  from unittest.mock import MagicMock, patch
  from ray.autoscaler._private.vsphere.vsphere_sdk_provider import VsphereSdkProvider, Constants, HardPower
label_desc: Use image node_id 3 for calling a global function with example usage: test_delete_vm_by_id(patch_vsphere_sdk_provider) without return types