code: def test_invalid_sparse_outputs_annotations(self, use_tf_compat_v1):
      def preprocessing_fn(inputs):
          tft.experimental.annotate_sparse_output_shape(
              inputs["x"], [3, 42]
          )
          return inputs
  
      input_data_dicts = [dict(x=[1]) for x in range(10)]
      input_metadata = tft.DatasetMetadata.from_feature_spec(
          {
              "x": tf.io.VarLenFeature(tf.int64),
          }
      )
      with self.assertRaisesRegex(  # pylint: disable=g-error-prone-assert-raises
          ValueError,
          r"Annotated shape \[3, 42\] was expected to have rank 1",
      ):
          self.assertAnalyzeAndTransformResults(
              input_data_dicts,
              input_metadata,
              preprocessing_fn,
              force_tf_compat_v1=use_tf_compat_v1,
          )
  
file_path: transform/tensorflow_transform/beam/annotators_test.py
imports: import tensorflow
  import tensorflow_transform
  from tensorflow_transform.beam import tft_unit
  from google.protobuf import text_format
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 3 for calling the AnnotatorsTest obj's underlying member method code with example usage: obj.test_invalid_sparse_outputs_annotations(use_tf_compat_v1) and returns: inputs