code: def test_list_named_actors_ray_kill(ray_start_regular):
      """Verify that names are returned even while actors are restarting."""
  
      @ray.remote(max_restarts=-1)
      class A:
          def __init__(self):
              pass
  
      a = A.options(name="hi").remote()
      assert ray.util.list_named_actors() == ["hi"]
      ray.kill(a, no_restart=False)
      assert ray.util.list_named_actors() == ["hi"]
      ray.kill(a, no_restart=True)
      assert not ray.util.list_named_actors()
  
imports: import pytest
  import sys
  import ray
  from ray._private.test_utils import run_string_as_driver
label_desc: Use image node_id 1 for calling a global function with example usage: test_list_named_actors_ray_kill(ray_start_regular) without return types