code: def testMeanNotOneFeatureValue(self):
      # This example should cause a ValueError because
      # the feature (age) contains more than one value.
      example = {
          "labels": None,
          "predictions": None,
          "features": {
              "example_weights": [2.2],
              "age": [18, 21],
          },
      }
  
      feature_key_path = ["features", "age"]
      example_weights_key_path = ["features", "example_weights"]
  
      mean_metric_computation = stats.Mean(
          feature_key_path,
          example_weights_key_path=example_weights_key_path,
      ).computations()[0]
  
      with self.assertRaisesRegex(
          AssertionError,
          r"Mean\(\) is only supported for scalar features, but found features = "
          r"\[18, 21\]",
      ):
          with beam.Pipeline() as pipeline:
              _ = (
                  pipeline
                  | "Create" >> beam.Create([example])
                  | "Process"
                  >> beam.Map(metric_util.to_standard_metric_inputs)
                  | "AddSlice" >> beam.Map(lambda x: ((), x))
                  | "ComputeMeanMetric"
                  >> beam.CombinePerKey(
                      mean_metric_computation.combiner
                  )
              )
  
imports: from absl.testing import parameterized
  import apache_beam
  from apache_beam.testing import util
  import numpy
  import tensorflow
  import tensorflow_model_analysis
  from tensorflow_model_analysis.eval_saved_model import testutil
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.metrics import stats
  from google.protobuf import text_format
label_desc: Use image node_id 1 for calling the MeanTestInvalidExamples obj's underlying member method code with example usage: obj.testMeanNotOneFeatureValue() without return types