code: def test_invalid_utility_analysis_params_throws_exception(self):
      # Arrange.
      default_extractors = self._get_default_extractors()
      default_params = self._get_default_aggregate_params()
      params_with_custom_combiners = copy.copy(default_params)
      params_with_custom_combiners.custom_combiners = sum
      params_with_unsupported_metric = copy.copy(default_params)
      params_with_unsupported_metric.metrics = [
          pipeline_dp.Metrics.MEAN
      ]
      params_with_contribution_bounds_already_enforced = copy.copy(
          default_params
      )
      params_with_contribution_bounds_already_enforced.contribution_bounds_already_enforced = (
          True
      )
  
      test_cases = [
          {
              "error_message": "custom combiners",
              "params": params_with_custom_combiners,
              "data_extractors": default_extractors,
              "public_partitions": [1],
              "pre_aggregated": False,
          },
          {
              "error_message": "unsupported metric in metrics",
              "params": params_with_unsupported_metric,
              "data_extractors": default_extractors,
              "public_partitions": [1],
              "pre_aggregated": False,
          },
          {
              "error_message": "contribution bounds are already enforced",
              "params": params_with_contribution_bounds_already_enforced,
              "data_extractors": default_extractors,
              "public_partitions": [1],
              "pre_aggregated": False,
          },
          {
              "error_message": "PreAggregateExtractors should be specified for pre-aggregated data",
              "params": default_params,
              "data_extractors": default_extractors,
              "public_partitions": [1],
              "pre_aggregated": True,
          },
      ]
  
      for test_case in test_cases:
          budget_accountant = budget_accounting.NaiveBudgetAccountant(
              total_epsilon=1, total_delta=1e-10
          )
          options = analysis.UtilityAnalysisOptions(
              epsilon=1,
              delta=0,
              aggregate_params=test_case["params"],
              pre_aggregated_data=test_case["pre_aggregated"],
          )
          engine = utility_analysis_engine.UtilityAnalysisEngine(
              budget_accountant=budget_accountant,
              backend=pipeline_dp.LocalBackend(),
          )
          # Act and assert.
          with self.assertRaisesRegex(
              Exception, expected_regex=test_case["error_message"]
          ):
              engine.analyze(
                  [0, 1, 2],
                  options,
                  test_case["data_extractors"],
                  public_partitions=test_case["public_partitions"],
              )
  
file_path: pipelinedp/analysis/tests/utility_analysis_engine_test.py
imports: from absl.testing import absltest
  from absl.testing import parameterized
  from unittest.mock import patch
  import copy
  import pipeline_dp
  from pipeline_dp import budget_accounting
  from analysis import utility_analysis_engine
  from analysis import metrics
  import analysis
label_desc: Use image node_id 4 for calling the UtilityAnalysisEngineTest obj's underlying member method code with example usage: obj.test_invalid_utility_analysis_params_throws_exception() without return types