code: def test_return_actor(self, ray_start_regular_shared):
      # Test that we can return an actor as many times as we've picked it.
      pool = _ActorPool(max_tasks_in_flight=999)
      self._add_ready_worker(pool)
      for _ in range(10):
          picked_actor = pool.pick_actor()
      # Return the actor as many times as it was picked.
      for _ in range(10):
          pool.return_actor(picked_actor)
      # Returning the actor more times than it has been picked should raise an
      # AssertionError.
      with pytest.raises(AssertionError):
          pool.return_actor(picked_actor)
      # Check that the per-state pool sizes are as expected.
      assert pool.num_total_actors() == 1
      assert pool.num_pending_actors() == 0
      assert pool.num_running_actors() == 1
      assert pool.num_active_actors() == 0
      assert pool.num_idle_actors() == 1  # Actor should now be idle.
      assert pool.num_free_slots() == 999
  
imports: import collections
  import time
  import pytest
  import ray
  from ray.data._internal.compute import ActorPoolStrategy
  from ray.data._internal.execution.operators.actor_pool_map_operator import AutoscalingConfig, AutoscalingPolicy, _ActorPool
  from ray.data._internal.execution.util import make_ref_bundles
  from ray.tests.conftest import *
label_desc: Use image node_id 5 for calling the TestActorPool obj's underlying member method code with example usage: obj.test_return_actor(ray_start_regular_shared) without return types