code: def testRaisesErrorWhenExampleWeightsDiffer(self):
      with self.assertRaises(ValueError):
          metric = min_label_position.MinLabelPosition().computations(
              query_key="query", example_weighted=True
          )[0]
  
          query1_example1 = {
              "labels": np.array([0.0]),
              "predictions": np.array([0.2]),
              "example_weights": np.array([1.0]),
              "features": {"query": np.array(["query1"])},
          }
          query1_example2 = {
              "labels": np.array([1.0]),
              "predictions": np.array([0.8]),
              "example_weights": np.array([0.5]),
              "features": {"query": np.array(["query1"])},
          }
  
          with beam.Pipeline() as pipeline:
              # pylint: disable=no-value-for-parameter
              _ = (
                  pipeline
                  | "Create"
                  >> beam.Create(
                      [
                          tfma_util.merge_extracts(
                              [query1_example1, query1_example2]
                          )
                      ]
                  )
                  | "Process"
                  >> beam.Map(
                      metric_util.to_standard_metric_inputs, True
                  )
                  | "AddSlice" >> beam.Map(lambda x: ((), x))
                  | "Combine" >> beam.CombinePerKey(metric.combiner)
              )
  
file_path: model-analysis/tensorflow_model_analysis/metrics/min_label_position_test.py
imports: import math
  from absl.testing import parameterized
  import apache_beam
  from apache_beam.testing import util
  import numpy
  import tensorflow
  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 min_label_position
  from tensorflow_model_analysis.utils import util
label_desc: Use image node_id 2 for calling the MinLabelPositionTest obj's underlying member method code with example usage: obj.testRaisesErrorWhenExampleWeightsDiffer() without return types