code: def run_pipeline_test(self, classifier, _):
      outputs = classifier(
          "Who are you voting for in 2020?", candidate_labels="politics"
      )
      self.assertEqual(
          outputs,
          {
              "sequence": ANY(str),
              "labels": [ANY(str)],
              "scores": [ANY(float)],
          },
      )
  
      # No kwarg
      outputs = classifier(
          "Who are you voting for in 2020?", ["politics"]
      )
      self.assertEqual(
          outputs,
          {
              "sequence": ANY(str),
              "labels": [ANY(str)],
              "scores": [ANY(float)],
          },
      )
  
      outputs = classifier(
          "Who are you voting for in 2020?",
          candidate_labels=["politics"],
      )
      self.assertEqual(
          outputs,
          {
              "sequence": ANY(str),
              "labels": [ANY(str)],
              "scores": [ANY(float)],
          },
      )
  
      outputs = classifier(
          "Who are you voting for in 2020?",
          candidate_labels="politics, public health",
      )
      self.assertEqual(
          outputs,
          {
              "sequence": ANY(str),
              "labels": [ANY(str), ANY(str)],
              "scores": [ANY(float), ANY(float)],
          },
      )
      self.assertAlmostEqual(
          sum(nested_simplify(outputs["scores"])), 1.0
      )
  
      outputs = classifier(
          "Who are you voting for in 2020?",
          candidate_labels=["politics", "public health"],
      )
      self.assertEqual(
          outputs,
          {
              "sequence": ANY(str),
              "labels": [ANY(str), ANY(str)],
              "scores": [ANY(float), ANY(float)],
          },
      )
      self.assertAlmostEqual(
          sum(nested_simplify(outputs["scores"])), 1.0
      )
  
      outputs = classifier(
          "Who are you voting for in 2020?",
          candidate_labels="politics",
          hypothesis_template="This text is about {}",
      )
      self.assertEqual(
          outputs,
          {
              "sequence": ANY(str),
              "labels": [ANY(str)],
              "scores": [ANY(float)],
          },
      )
  
      # https://github.com/huggingface/transformers/issues/13846
      outputs = classifier(["I am happy"], ["positive", "negative"])
      self.assertEqual(
          outputs,
          [
              {
                  "sequence": ANY(str),
                  "labels": [ANY(str), ANY(str)],
                  "scores": [ANY(float), ANY(float)],
              }
              for i in range(1)
          ],
      )
      outputs = classifier(
          ["I am happy", "I am sad"], ["positive", "negative"]
      )
      self.assertEqual(
          outputs,
          [
              {
                  "sequence": ANY(str),
                  "labels": [ANY(str), ANY(str)],
                  "scores": [ANY(float), ANY(float)],
              }
              for i in range(2)
          ],
      )
  
      with self.assertRaises(ValueError):
          classifier("", candidate_labels="politics")
  
      with self.assertRaises(TypeError):
          classifier(None, candidate_labels="politics")
  
      with self.assertRaises(ValueError):
          classifier(
              "Who are you voting for in 2020?", candidate_labels=""
          )
  
      with self.assertRaises(TypeError):
          classifier(
              "Who are you voting for in 2020?", candidate_labels=None
          )
  
      with self.assertRaises(ValueError):
          classifier(
              "Who are you voting for in 2020?",
              candidate_labels="politics",
              hypothesis_template="Not formatting template",
          )
  
      with self.assertRaises(AttributeError):
          classifier(
              "Who are you voting for in 2020?",
              candidate_labels="politics",
              hypothesis_template=None,
          )
  
      self.run_entailment_id(classifier)
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/tests/pipelines/test_pipelines_zero_shot.py
imports: import unittest
  from transformers import MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline
  from transformers.testing_utils import nested_simplify, require_tf, require_torch, slow
  from .test_pipelines_common import ANY, PipelineTestCaseMeta
label_desc: Use image node_id 2 for calling the ZeroShotClassificationPipelineTests obj's underlying member method code with example usage: obj.run_pipeline_test(classifier, _) without return types