code: def test_analyze_applies_public_partitions(
      self, pre_aggregated: bool
  ):
      # Arrange
      aggregator_params = self._get_default_aggregate_params()
  
      budget_accountant = pipeline_dp.NaiveBudgetAccountant(
          total_epsilon=1, total_delta=1e-10
      )
  
      public_partitions = ["pk0", "pk1", "empty_public_partition"]
  
      # Input collection has 100 elements, such that each privacy id
      # contributes 1 time and each partition has 1 element.
      input = list(range(100))
  
      if not pre_aggregated:
          data_extractors = pipeline_dp.DataExtractors(
              privacy_id_extractor=lambda x: x,
              partition_extractor=lambda x: f"pk{x}",
              value_extractor=lambda x: 0,
          )
      else:
          data_extractors = pipeline_dp.PreAggregateExtractors(
              partition_extractor=lambda x: f"pk{x}",
              preaggregate_extractor=lambda x: (1, 0, 1),
          )
  
      engine = utility_analysis_engine.UtilityAnalysisEngine(
          budget_accountant=budget_accountant,
          backend=pipeline_dp.LocalBackend(),
      )
  
      options = analysis.UtilityAnalysisOptions(
          epsilon=1,
          delta=0,
          aggregate_params=aggregator_params,
          pre_aggregated_data=pre_aggregated,
      )
      # Act.
      output = engine.analyze(
          col=input,
          options=options,
          data_extractors=data_extractors,
          public_partitions=public_partitions,
      )
      budget_accountant.compute_budgets()
  
      output = list(output)
  
      # Assert public partitions are applied.
      self.assertLen(output, 3)
      self.assertTrue(
          any(v[0] == "empty_public_partition" for v in output)
      )
  
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 5 for calling the UtilityAnalysisEngineTest obj's underlying member method code with example usage: obj.test_analyze_applies_public_partitions(pre_aggregated) without return types