code: def test_list_named_actors_detached(ray_start_regular):
      """Verify that names are returned for detached actors until killed."""
      address = ray_start_regular["address"]
  
      driver_script = """
  import ray
  ray.init(address="{}", namespace="default_test_namespace")
  
  @ray.remote
  class A:
      pass
  
  A.options(name="hi", lifetime="detached").remote()
  a = A.options(name="sad").remote()
  
  assert len(ray.util.list_named_actors()) == 2
  assert "hi" in ray.util.list_named_actors()
  assert "sad" in ray.util.list_named_actors()
  """.format(
          address
      )
  
      run_string_as_driver(driver_script)
  
      assert ray.util.list_named_actors() == ["hi"]
  
imports: import pytest
  import sys
  import ray
  from ray._private.test_utils import run_string_as_driver
label_desc: Use image node_id 2 for calling a global function with example usage: test_list_named_actors_detached(ray_start_regular) without return types