code: def test_tune_sum(self):
      # Arrange.
      # Generate dataset, with 10 privacy units, each of them contribute to
      # the same partition with value equal to its id.
      input = [(i, f"pk0", i) for i in range(10)]
      public_partitions = [f"pk{i}" for i in range(10)]
      data_extractors = pipeline_dp.DataExtractors(
          privacy_id_extractor=lambda x: x[0],
          partition_extractor=lambda x: x[1],
          value_extractor=lambda x: x[2],
      )
  
      contribution_histograms = list(
          computing_histograms.compute_dataset_histograms(
              input, data_extractors, pipeline_dp.LocalBackend()
          )
      )[0]
  
      tune_options = _get_tune_options(
          [pipeline_dp.Metrics.SUM],
          parameter_tuning.ParametersToTune(
              max_partitions_contributed=True,
              max_sum_per_partition=True,
          ),
      )
  
      # Act.
      result = parameter_tuning.tune(
          input,
          pipeline_dp.LocalBackend(),
          contribution_histograms,
          tune_options,
          data_extractors,
          public_partitions,
      )
  
      # Assert.
      tune_result, per_partition_utility_analysis = result
      per_partition_utility_analysis = list(
          per_partition_utility_analysis
      )
      self.assertLen(per_partition_utility_analysis, 10)
  
      tune_result = list(tune_result)[0]
  
      self.assertEqual(tune_options, tune_result.options)
      self.assertEqual(
          contribution_histograms, tune_result.contribution_histograms
      )
      utility_reports = tune_result.utility_reports
      self.assertLen(utility_reports, 1)
      self.assertIsInstance(utility_reports[0], metrics.UtilityReport)
      self.assertLen(utility_reports[0].metric_errors, 1)
      self.assertEqual(
          utility_reports[0].metric_errors[0].metric,
          pipeline_dp.Metrics.SUM,
      )
  
imports: from absl.testing import absltest
  from absl.testing import parameterized
  from unittest import mock
  from unittest.mock import patch
  from typing import List, Optional
  import pipeline_dp
  import analysis
  from analysis import metrics
  from analysis import parameter_tuning
  from pipeline_dp.dataset_histograms import histograms
  from pipeline_dp.dataset_histograms import computing_histograms
label_desc: Use image node_id 9 for calling the ParameterTuning obj's underlying member method code with example usage: obj.test_tune_sum() without return types