code: def test_transition_graph(self):
      # Assert on each edge in the graph.
      all_status = set(Instance.InstanceStatus.values())
  
      g = InstanceUtil.get_valid_transitions()
  
      assert g[Instance.QUEUED] == {Instance.REQUESTED}
      all_status.remove(Instance.QUEUED)
  
      assert g[Instance.REQUESTED] == {
          Instance.ALLOCATED,
          Instance.ALLOCATION_FAILED,
      }
      all_status.remove(Instance.REQUESTED)
  
      assert g[Instance.ALLOCATED] == {
          Instance.RAY_INSTALLING,
          Instance.RAY_RUNNING,
          Instance.STOPPING,
          Instance.STOPPED,
      }
      all_status.remove(Instance.ALLOCATED)
  
      assert g[Instance.RAY_INSTALLING] == {
          Instance.RAY_RUNNING,
          Instance.RAY_INSTALL_FAILED,
          Instance.RAY_STOPPED,
          Instance.STOPPED,
      }
      all_status.remove(Instance.RAY_INSTALLING)
  
      assert g[Instance.RAY_RUNNING] == {
          Instance.RAY_STOPPING,
          Instance.RAY_STOPPED,
          Instance.STOPPED,
      }
      all_status.remove(Instance.RAY_RUNNING)
  
      assert g[Instance.RAY_STOPPING] == {
          Instance.RAY_STOPPED,
          Instance.STOPPED,
      }
      all_status.remove(Instance.RAY_STOPPING)
  
      assert g[Instance.RAY_STOPPED] == {
          Instance.STOPPED,
          Instance.STOPPING,
      }
      all_status.remove(Instance.RAY_STOPPED)
  
      assert g[Instance.STOPPING] == {Instance.STOPPED}
      all_status.remove(Instance.STOPPING)
  
      assert g[Instance.STOPPED] == set()
      all_status.remove(Instance.STOPPED)
  
      assert g[Instance.ALLOCATION_FAILED] == {Instance.QUEUED}
      all_status.remove(Instance.ALLOCATION_FAILED)
  
      assert g[Instance.RAY_INSTALL_FAILED] == {
          Instance.STOPPED,
          Instance.STOPPING,
      }
      all_status.remove(Instance.RAY_INSTALL_FAILED)
  
      assert g[Instance.UNKNOWN] == set()
      all_status.remove(Instance.UNKNOWN)
  
      assert len(all_status) == 0
  
file_path: ray/python/ray/autoscaler/v2/tests/test_instance_manager.py
imports: import os
  import sys
  import unittest
  from typing import Dict, Set
  from unittest.mock import patch
  import pytest
  from ray.autoscaler.v2.instance_manager.instance_manager import InstanceUtil
  from ray.autoscaler.v2.schema import InvalidInstanceStatusError
  from ray.core.generated.instance_manager_pb2 import Instance
label_desc: Use image node_id 2 for calling the InstanceUtilTest obj's underlying member method code with example usage: obj.test_transition_graph() without return types