code: def test_calculate_private_contribution_filters_partitions(self):
      # Arrange
      engine = pipeline_dp.DPEngine(
          budget_accountant=None, backend=pipeline_dp.LocalBackend()
      )
      params = pipeline_dp.CalculatePrivateContributionBoundsParams(
          aggregation_eps=0.9,
          aggregation_delta=0.001,
          calculation_eps=0.1,
          aggregation_noise_kind=pipeline_dp.NoiseKind.LAPLACE,
          max_partitions_contributed_upper_bound=2,
      )
      # user 0 contributes only 1 partitions, others contribute to both
      data = [("pk0", 0)]
      for i in range(10000):
          data += [("pk0", i + 1), ("pk1", i + 1)]
      data_extractors = pipeline_dp.DataExtractors(
          partition_extractor=lambda x: x[0],
          privacy_id_extractor=lambda x: x[1],
          value_extractor=lambda _: 1,
      )
      partitions = ["pk0"]
  
      # Act
      result = engine.calculate_private_contribution_bounds(
          data,
          params,
          data_extractors,
          partitions,
          partitions_already_filtered=False,
      )
      result = list(result)[0]
  
      # Assert
      # If partitions were not filtered, it would return 2 as in the previous
      # test.
      self.assertEqual(
          result,
          pipeline_dp.PrivateContributionBounds(
              max_partitions_contributed=1
          ),
      )
  
imports: import sys
  import unittest
  from typing import List, Optional, Tuple
  from unittest.mock import patch
  import numpy
  import apache_beam
  import apache_beam.testing.test_pipeline
  import apache_beam.testing.util
  import pydp.algorithms.partition_selection
  from absl.testing import absltest
  from absl.testing import parameterized
  import pipeline_dp
  from pipeline_dp import aggregate_params
  from pipeline_dp import budget_accounting
  from pipeline_dp import dp_computations
  from pipeline_dp.budget_accounting import NaiveBudgetAccountant
  from pipeline_dp.pipeline_backend import PipelineBackend
  from pipeline_dp.pipeline_functions import collect_to_container
  from pipeline_dp.report_generator import ReportGenerator
label_desc: Use image node_id 7 for calling the DpEngineTest obj's underlying member method code with example usage: obj.test_calculate_private_contribution_filters_partitions() without return types