code: def test_metric_utility(
      self, metric: pipeline_dp.Metric, keep_prob: float
  ):
      input = metrics.SumMetrics(
          aggregation=metric,
          sum=10.0,
          clipping_to_min_error=0.0,
          clipping_to_max_error=-5.0,
          expected_l0_bounding_error=-2.0,
          std_l0_bounding_error=3.0,
          std_noise=4.0,
          noise_kind=pipeline_dp.NoiseKind.LAPLACE,
      )
      output: metrics.MetricUtility = (
          cross_partition_combiners._sum_metrics_to_metric_utility(
              input,
              metric,
              partition_keep_probability=keep_prob,
              partition_weight=keep_prob,
          )
      )
  
      self.assertEqual(output.metric, metric)
      self.assertEqual(output.noise_kind, input.noise_kind)
      self.assertEqual(output.noise_std, input.std_noise)
  
      # Check absolute_error.
      abs_error: metrics.ValueErrors = output.absolute_error
      # (expected_l0_bounding_error + clipping_to_min_error +
      # clipping_to_max_error) = -7
      self.assertEqual(abs_error.mean, (-2 + 0 + (-5)) * keep_prob)
      # (std_l0_bounding_error**2 + std_noise**2) = 25
      self.assertEqual(
          abs_error.variance, (3**2 + 4**2) * keep_prob
      )
      # sqrt(mean ** 2 + variance)
      self.assertAlmostEqual(
          abs_error.rmse,
          math.sqrt(7**2 + 25) * keep_prob,
          delta=1e-12,
      )
  
      bounding_errors = abs_error.bounding_errors
      self.assertEqual(
          bounding_errors.l0,
          metrics.MeanVariance(-2.0 * keep_prob, (3**2) * keep_prob),
      )
      self.assertEqual(bounding_errors.linf_min, 0.0 * keep_prob)
      self.assertEqual(bounding_errors.linf_max, -5.0 * keep_prob)
  
      # Check relative_error.
      expected_rel_error = abs_error.to_relative(input.sum)
      self.assertEqual(output.relative_error, expected_rel_error)
      # mean / sum = -7 / 10
      self.assertAlmostEqual(
          output.relative_error.mean, -0.7 * keep_prob, delta=1e-12
      )
  
imports: from absl.testing import absltest
  from absl.testing import parameterized
  import dataclasses
  import math
  from unittest import mock
  from unittest.mock import patch
  from analysis import metrics
  from analysis import cross_partition_combiners
  import pipeline_dp
label_desc: Use image node_id 1 for calling the PerPartitionToCrossPartitionMetrics obj's underlying member method code with example usage: obj.test_metric_utility(metric, keep_prob) without return types