code: def test_delete():
      subscriber = DummySubscriber()
  
      storage = InstanceStorage(
          cluster_id="test_cluster",
          storage=InMemoryStorage(),
          status_change_subscriber=subscriber,
      )
      instance1 = create_instance("instance1")
      instance2 = create_instance("instance2")
      instance3 = create_instance("instance3")
  
      assert (True, 1) == storage.batch_upsert_instances(
          [instance1, instance2, instance3],
          expected_storage_version=None,
      )
  
      assert (False, 1) == storage.batch_delete_instances(
          instance_ids=["instance1"], expected_storage_version=0
      )
      assert (True, 2) == storage.batch_delete_instances(
          instance_ids=["instance1"]
      )
  
      assert subscriber.events == [
          InstanceUpdateEvent(
              instance_id="instance1",
              new_instance_status=Instance.UNKNOWN,
          ),
          InstanceUpdateEvent(
              instance_id="instance2",
              new_instance_status=Instance.UNKNOWN,
          ),
          InstanceUpdateEvent(
              instance_id="instance3",
              new_instance_status=Instance.UNKNOWN,
          ),
      ]
  
      assert (
          {
              "instance2": create_instance("instance2", version=1),
              "instance3": create_instance("instance3", version=1),
          },
          2,
      ) == storage.get_instances()
  
      assert (True, 3) == storage.batch_delete_instances(
          instance_ids=["instance2"], expected_storage_version=2
      )
  
      assert (
          {
              "instance3": create_instance("instance3", version=1),
          },
          3,
      ) == storage.get_instances()
  
      assert subscriber.events == [
          InstanceUpdateEvent(
              instance_id="instance1",
              new_instance_status=Instance.UNKNOWN,
          ),
          InstanceUpdateEvent(
              instance_id="instance2",
              new_instance_status=Instance.UNKNOWN,
          ),
          InstanceUpdateEvent(
              instance_id="instance3",
              new_instance_status=Instance.UNKNOWN,
          ),
      ]
  
file_path: ray/python/ray/autoscaler/v2/tests/test_instance_storage.py
imports: import copy
  import os
  import sys
  from unittest import mock
  import pytest
  from ray.autoscaler.v2.instance_manager.instance_storage import InstanceStorage, InstanceUpdatedSubscriber, InstanceUpdateEvent
  from ray.autoscaler.v2.instance_manager.storage import InMemoryStorage
  from ray.core.generated.instance_manager_pb2 import Instance
label_desc: Use image node_id 4 for calling a global function with example usage: test_delete() without return types