code: def test_classify(
      self,
      model_file_type,
      model_name,
      text,
      expected_classification_result,
  ):
      # Creates classifier.
      model_path = test_utils.get_test_data_path(
          os.path.join(_TEST_DATA_DIR, model_name)
      )
      if model_file_type is ModelFileType.FILE_NAME:
          base_options = _BaseOptions(model_asset_path=model_path)
      elif model_file_type is ModelFileType.FILE_CONTENT:
          with open(model_path, "rb") as f:
              model_content = f.read()
          base_options = _BaseOptions(model_asset_buffer=model_content)
      else:
          # Should never happen
          raise ValueError("model_file_type is invalid.")
  
      options = _TextClassifierOptions(base_options=base_options)
      classifier = _TextClassifier.create_from_options(options)
  
      # Performs text classification on the input.
      text_result = classifier.classify(text)
      # Comparing results.
      test_utils.assert_proto_equals(
          self,
          text_result.to_pb2(),
          expected_classification_result.to_pb2(),
      )
      # Closes the classifier explicitly when the classifier is not used in
      # a context.
      classifier.close()
  
file_path: mediapipe/mediapipe/tasks/python/test/text/text_classifier_test.py
imports: import enum
  import os
  from absl.testing import absltest
  from absl.testing import parameterized
  from mediapipe.tasks.python.components.containers import category
  from mediapipe.tasks.python.components.containers import classification_result
  from mediapipe.tasks.python.core import base_options
  from mediapipe.tasks.python.test import test_utils
  from mediapipe.tasks.python.text import text_classifier
label_desc: Use image node_id 6 for calling the TextClassifierTest obj's underlying member method code with example usage: obj.test_classify(model_file_type, model_name, text, expected_classification_result) without return types