code: def test_requires_actor_restart():
      # Code version different
      v1 = DeploymentVersion("1", DeploymentConfig(), {"num_cpus": 0.1})
      v2 = DeploymentVersion("2", DeploymentConfig(), {"num_cpus": 0.1})
      assert v1.requires_actor_restart(v2)
  
      # Runtime env different
      v1 = DeploymentVersion("1", DeploymentConfig(), {"num_cpus": 0.1})
      v2 = DeploymentVersion("1", DeploymentConfig(), {"num_cpus": 0.2})
      assert v1.requires_actor_restart(v2)
  
      # Placement group bundles different
      v1 = DeploymentVersion(
          "1",
          DeploymentConfig(),
          {},
          placement_group_bundles=[{"CPU": 0.1}],
      )
      v2 = DeploymentVersion(
          "1",
          DeploymentConfig(),
          {},
          placement_group_bundles=[{"CPU": 0.2}],
      )
      assert v1.requires_actor_restart(v2)
  
      # Placement group strategy different
      v1 = DeploymentVersion(
          "1", DeploymentConfig(), {}, placement_group_strategy="PACK"
      )
      v2 = DeploymentVersion(
          "1", DeploymentConfig(), {}, placement_group_strategy="SPREAD"
      )
      assert v1.requires_actor_restart(v2)
  
      # Both code version and runtime env different
      v1 = DeploymentVersion("1", DeploymentConfig(), {"num_cpus": 0.1})
      v2 = DeploymentVersion("2", DeploymentConfig(), {"num_cpus": 0.2})
      assert v1.requires_actor_restart(v2)
  
      # Num replicas is different
      v1 = DeploymentVersion("1", DeploymentConfig(num_replicas=1), {})
      v2 = DeploymentVersion("1", DeploymentConfig(num_replicas=2), {})
      assert not v1.requires_actor_restart(v2)
  
      # Graceful shutdown timeout is different
      v1 = DeploymentVersion(
          "1", DeploymentConfig(graceful_shutdown_timeout_s=5), {}
      )
      v2 = DeploymentVersion(
          "1", DeploymentConfig(graceful_shutdown_timeout_s=10), {}
      )
      assert not v1.requires_actor_restart(v2)
  
imports: import pytest
  import ray
  from ray.serve._private.config import DeploymentConfig
  from ray.serve._private.deployment_state import DeploymentVersion
label_desc: Use image node_id 21 for calling a global function with example usage: test_requires_actor_restart() without return types