code: def testComponentSpec_Basic(self):
      proto = example_gen_pb2.Input()
      proto.splits.extend(
          [
              example_gen_pb2.Input.Split(
                  name="name1", pattern="pattern1"
              ),
              example_gen_pb2.Input.Split(
                  name="name2", pattern="pattern2"
              ),
              example_gen_pb2.Input.Split(
                  name="name3", pattern="pattern3"
              ),
          ]
      )
      input_channel = channel.Channel(type=_InputArtifact)
      output_channel = channel.Channel(type=_OutputArtifact)
      spec = _BasicComponentSpec(
          folds=10,
          proto=proto,
          input=input_channel,
          output=output_channel,
      )
      # Verify proto property.
      self.assertIsInstance(spec.exec_properties["proto"], str)
      decoded_proto = json.loads(spec.exec_properties["proto"])
      self.assertCountEqual(["splits"], decoded_proto.keys())
      self.assertLen(decoded_proto["splits"], 3)
      self.assertCountEqual(
          ["name1", "name2", "name3"],
          list(s["name"] for s in decoded_proto["splits"]),
      )
      self.assertCountEqual(
          ["pattern1", "pattern2", "pattern3"],
          list(s["pattern"] for s in decoded_proto["splits"]),
      )
  
      # Verify other properties.
      self.assertEqual(10, spec.exec_properties["folds"])
      self.assertIs(spec.inputs["input"], input_channel)
      self.assertIs(spec.outputs["output"], output_channel)
  
      with self.assertRaisesRegex(
          TypeError,
          "Expected type <(class|type) 'int'> for parameter u?'folds' but got "
          "str.",
      ):
          spec = _BasicComponentSpec(
              folds="string", input=input_channel, output=output_channel
          )
  
      with self.assertRaisesRegex(
          TypeError,
          ".*should be a Channel of .*InputArtifact.*got (.|\\s)*Examples.*",
      ):
          spec = _BasicComponentSpec(
              folds=10,
              input=channel.Channel(type=Examples),
              output=output_channel,
          )
  
      with self.assertRaisesRegex(
          TypeError,
          ".*should be a Channel of .*OutputArtifact.*got (.|\\s)*Examples.*",
      ):
          spec = _BasicComponentSpec(
              folds=10,
              input=input_channel,
              output=channel.Channel(type=Examples),
          )
  
imports: import json
  import sys
  from typing import Dict, List
  import unittest
  import tensorflow
  from tfx.dsl.placeholder import placeholder
  from tfx.proto import example_gen_pb2
  from tfx.types import artifact
  from tfx.types import channel
  from tfx.types import component_spec
  from tfx.types.component_spec import ChannelParameter
  from tfx.types.component_spec import ComponentSpec
  from tfx.types.component_spec import ExecutionParameter
  from tfx.types.standard_artifacts import Examples
  from tfx.utils import proto_utils
  from google.protobuf import json_format
  from google.protobuf import text_format
label_desc: Use image node_id 2 for calling the ComponentSpecTest obj's underlying member method code with example usage: obj.testComponentSpec_Basic() without return types