docstr: Test that a deployment scales down to 0 for non-default smoothing factors.
docstr_tok: ["Test","that","a","deployment","scales","down","to","0","for","non-default","smoothing","factors","."]
code: def test_smoothing_factor_scale_down_to_0_replicas(self):
      """Test that a deployment scales down to 0 for non-default smoothing factors."""
  
      # With smoothing factor > 1, the desired number of replicas should
      # immediately drop to 0 (while respecting upscale and downscale delay)
      config = AutoscalingConfig(
          min_replicas=0,
          max_replicas=5,
          smoothing_factor=10,
          upscale_delay_s=0,
          downscale_delay_s=0,
      )
      policy_manager = AutoscalingPolicyManager(config)
      new_num_replicas = policy_manager.get_decision_num_replicas(
          current_num_ongoing_requests=[0, 0, 0, 0, 0],
          curr_target_num_replicas=5,
          current_handle_queued_queries=0,
      )
  
      assert new_num_replicas == 0
  
      # With smoothing factor < 1, the desired number of replicas shouldn't
      # get stuck at a positive number, and instead should eventually drop
      # to zero
      config.smoothing_factor = 0.2
      policy_manager = AutoscalingPolicyManager(config)
      num_replicas = 5
      for _ in range(5):
          num_replicas = policy_manager.get_decision_num_replicas(
              current_num_ongoing_requests=[0] * num_replicas,
              curr_target_num_replicas=num_replicas,
              current_handle_queued_queries=0,
          )
  
      assert num_replicas == 0
  
imports: import sys
  import numpy
  import pytest
  from ray.serve._private.autoscaling_policy import AutoscalingPolicyManager
  from ray.serve._private.constants import CONTROL_LOOP_PERIOD_S
  from ray.serve.autoscaling_policy import _calculate_desired_num_replicas
  from ray.serve.config import AutoscalingConfig
label_desc: Use image node_id 2 for calling the TestGetDecisionNumReplicas obj's underlying member method code with example usage: obj.test_smoothing_factor_scale_down_to_0_replicas() without return types