code: def test_get_sparse_features(
      features: Optional[List[Features]],
      attribute: Text,
      featurizers: List[Text],
      expected_seq_features: Optional[List[Features]],
      expected_sen_features: Optional[List[Features]],
  ):
      message = Message(
          data={TEXT: "This is a test sentence."}, features=features
      )
  
      (
          actual_seq_features,
          actual_sen_features,
      ) = message.get_sparse_features(attribute, featurizers)
      if actual_seq_features:
          actual_seq_features = actual_seq_features.features
      if actual_sen_features:
          actual_sen_features = actual_sen_features.features
  
      if expected_seq_features is None:
          assert actual_seq_features is None
      else:
          assert actual_seq_features is not None
          assert np.all(
              actual_seq_features.toarray() == expected_seq_features
          )
  
      if expected_sen_features is None:
          assert actual_sen_features is None
      else:
          assert actual_sen_features is not None
          assert np.all(
              actual_sen_features.toarray() == expected_sen_features
          )
  
file_path: rasa/tests/shared/nlu/training_data/test_message.py
imports: from typing import Optional, Text, List
  import pytest
  import numpy
  import scipy.sparse
  from rasa.shared.nlu.training_data.features import Features
  from rasa.shared.nlu.constants import TEXT, FEATURE_TYPE_SENTENCE, FEATURE_TYPE_SEQUENCE, ACTION_TEXT, ACTION_NAME, INTENT, RESPONSE
  from rasa.shared.nlu.training_data.message import Message
  from rasa.nlu.tokenizers.whitespace_tokenizer import WhitespaceTokenizer
label_desc: Use image node_id 2 for calling a global function with example usage: test_get_sparse_features(features, attribute, featurizers, expected_seq_features, expected_sen_features) without return types