code: def testResolveSingleChannel_BadContextQuery(self):
      with self.subTest("No type"):
          ch = self.make_channel_spec(
              """
          context_queries {
            name {
              field_value {
                string_value: "my-pipeline"
              }
            }
          }
        """
          )
          with self.assertRaises(ValueError):
              channel_resolver.resolve_single_channel(
                  self.mlmd_handle, ch
              )
  
      with self.subTest("No type.name"):
          ch = self.make_channel_spec(
              """
          context_queries {
            type {
              id: 123
            }
            name {
              field_value {
                string_value: "my-pipeline"
              }
            }
          }
        """
          )
          with self.assertRaises(ValueError):
              channel_resolver.resolve_single_channel(
                  self.mlmd_handle, ch
              )
  
      with self.subTest("No name"):
          ch = self.make_channel_spec(
              """
          context_queries {
            type {
              name: "pipeline"
            }
          }
        """
          )
          with self.assertRaises(ValueError):
              channel_resolver.resolve_single_channel(
                  self.mlmd_handle, ch
              )
  
      with self.subTest("Non-existential"):
          ch = self.make_channel_spec(
              """
          context_queries {
            type {
              name: "i dont exist"
            }
            name {
              field_value {
                string_value: "i dont exist"
              }
            }
          }
        """
          )
          resolved = channel_resolver.resolve_single_channel(
              self.mlmd_handle, ch
          )
          self.assertEmpty(resolved)
  
file_path: tfx/tfx/orchestration/portable/input_resolution/channel_resolver_test.py
imports: import tensorflow
  from tfx.orchestration.portable.input_resolution import channel_resolver
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.utils import test_case_utils
  from google.protobuf import text_format
label_desc: Use image node_id 4 for calling the ChannelResolverTest obj's underlying member method code with example usage: obj.testResolveSingleChannel_BadContextQuery() without return types