docstr: Test validation of `target_capacity` field.
docstr_tok: ["Test","validation","of","`","target_capacity","`","field","."]
code: def test_target_capacity(
      self,
      input_val: Union[None, int, float],
      error: bool,
      output_val: Optional[float],
  ):
      """Test validation of `target_capacity` field."""
  
      deploy_config_dict = {
          "applications": [],
      }
      if input_val is not None:
          deploy_config_dict["target_capacity"] = input_val
  
      if error:
          with pytest.raises(ValidationError):
              ServeDeploySchema.parse_obj(deploy_config_dict)
      else:
          s = ServeDeploySchema.parse_obj(deploy_config_dict)
          assert s.target_capacity == output_val
  
imports: import copy
  import json
  import logging
  import sys
  from typing import Dict, List, Optional, Union
  import pytest
  from ray import serve
  from ray._private.pydantic_compat import ValidationError
  from ray.serve.config import AutoscalingConfig
  from ray.serve.deployment import deployment_to_schema, schema_to_deployment
  from ray.serve.schema import DeploymentSchema, LoggingConfig, RayActorOptionsSchema, ServeApplicationSchema, ServeDeploySchema, ServeInstanceDetails
  from ray.serve.tests.common.remote_uris import TEST_DEPLOY_GROUP_PINNED_URI, TEST_MODULE_PINNED_URI
  from ray.util.accelerators.accelerators import NVIDIA_TESLA_P4, NVIDIA_TESLA_V100
label_desc: Use image node_id 8 for calling the TestServeDeploySchema obj's underlying member method code with example usage: obj.test_target_capacity(input_val, error, output_val) without return types