code: def run_aggregation_strategy(self, model, tokenizer):
      token_classifier = TokenClassificationPipeline(
          model=model,
          tokenizer=tokenizer,
          aggregation_strategy="simple",
      )
      self.assertEqual(
          token_classifier._postprocess_params["aggregation_strategy"],
          AggregationStrategy.SIMPLE,
      )
      outputs = token_classifier("A simple string")
      self.assertIsInstance(outputs, list)
      n = len(outputs)
      self.assertEqual(
          nested_simplify(outputs),
          [
              {
                  "entity_group": ANY(str),
                  "score": ANY(float),
                  "start": ANY(int),
                  "end": ANY(int),
                  "word": ANY(str),
              }
              for i in range(n)
          ],
      )
  
      token_classifier = TokenClassificationPipeline(
          model=model, tokenizer=tokenizer, aggregation_strategy="first"
      )
      self.assertEqual(
          token_classifier._postprocess_params["aggregation_strategy"],
          AggregationStrategy.FIRST,
      )
      outputs = token_classifier("A simple string")
      self.assertIsInstance(outputs, list)
      n = len(outputs)
      self.assertEqual(
          nested_simplify(outputs),
          [
              {
                  "entity_group": ANY(str),
                  "score": ANY(float),
                  "start": ANY(int),
                  "end": ANY(int),
                  "word": ANY(str),
              }
              for i in range(n)
          ],
      )
  
      token_classifier = TokenClassificationPipeline(
          model=model, tokenizer=tokenizer, aggregation_strategy="max"
      )
      self.assertEqual(
          token_classifier._postprocess_params["aggregation_strategy"],
          AggregationStrategy.MAX,
      )
      outputs = token_classifier("A simple string")
      self.assertIsInstance(outputs, list)
      n = len(outputs)
      self.assertEqual(
          nested_simplify(outputs),
          [
              {
                  "entity_group": ANY(str),
                  "score": ANY(float),
                  "start": ANY(int),
                  "end": ANY(int),
                  "word": ANY(str),
              }
              for i in range(n)
          ],
      )
  
      token_classifier = TokenClassificationPipeline(
          model=model,
          tokenizer=tokenizer,
          aggregation_strategy="average",
      )
      self.assertEqual(
          token_classifier._postprocess_params["aggregation_strategy"],
          AggregationStrategy.AVERAGE,
      )
      outputs = token_classifier("A simple string")
      self.assertIsInstance(outputs, list)
      n = len(outputs)
      self.assertEqual(
          nested_simplify(outputs),
          [
              {
                  "entity_group": ANY(str),
                  "score": ANY(float),
                  "start": ANY(int),
                  "end": ANY(int),
                  "word": ANY(str),
              }
              for i in range(n)
          ],
      )
  
      with self.assertWarns(UserWarning):
          token_classifier = pipeline(
              task="ner",
              model=model,
              tokenizer=tokenizer,
              grouped_entities=True,
          )
      self.assertEqual(
          token_classifier._postprocess_params["aggregation_strategy"],
          AggregationStrategy.SIMPLE,
      )
      with self.assertWarns(UserWarning):
          token_classifier = pipeline(
              task="ner",
              model=model,
              tokenizer=tokenizer,
              grouped_entities=True,
              ignore_subwords=True,
          )
      self.assertEqual(
          token_classifier._postprocess_params["aggregation_strategy"],
          AggregationStrategy.FIRST,
      )
  
imports: import unittest
  import numpy
  from transformers import MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING, TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING, AutoModelForTokenClassification, AutoTokenizer, TokenClassificationPipeline, pipeline
  from transformers.pipelines import AggregationStrategy, TokenClassificationArgumentHandler
  from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch, require_torch_accelerator, slow, torch_device
  from .test_pipelines_common import ANY
label_desc: Use image node_id 3 for calling the TokenClassificationPipelineTests obj's underlying member method code with example usage: obj.run_aggregation_strategy(model, tokenizer) without return types