code: def test_should_scale_down_idle_to_total_ratio(self):
      # Test that scale-down is blocked if under the idle workers to total workers
      # ratio.
      config = AutoscalingConfig(
          min_workers=1, max_workers=4, idle_to_total_workers_ratio=0.5
      )
      policy = AutoscalingPolicy(config)
      num_total_workers = 4
      num_idle_workers = 1
      # Shouldn't scale down due to being under idle workers to total workers ratio.
      assert not policy.should_scale_down(
          num_total_workers, num_idle_workers
      )
  
      num_total_workers = 4
      num_idle_workers = 3
      # Should scale down due to being over idle workers to total workers ratio.
      assert policy.should_scale_down(
          num_total_workers, num_idle_workers
      )
  
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 7 for calling the TestAutoscalingPolicy obj's underlying member method code with example usage: obj.test_should_scale_down_idle_to_total_ratio() without return types