code: def test_sketch(self, metric):
      # Create dataset.
      number_of_sampled_partitions = 5
      input_size = 100
      input_data = range(input_size)
  
      # Run sketch and check results
      data_extractor = pipeline_dp.DataExtractors(
          privacy_id_extractor=lambda x: f"pid{x}",
          partition_extractor=lambda x: f"pk{x%10}",
          value_extractor=lambda x: x,
      )
      params = data_peeker.SampleParams(
          number_of_sampled_partitions=number_of_sampled_partitions,
          metrics=[metric],
      )
      key_to_pv_pcount = collections.defaultdict(list)
      for pk, pv, pcount in self._peeker.sketch(
          input_data, params, data_extractor
      ):
          key_to_pv_pcount[pk].append((pv, pcount))
      self.assertLen(key_to_pv_pcount, number_of_sampled_partitions)
      for pv_pcount_list in key_to_pv_pcount.values():
          self.assertLen(pv_pcount_list, input_size / 10)
          self.assertTrue(
              all(pcount == 1 for _, pcount in pv_pcount_list)
          )
          if metric == pipeline_dp.Metrics.COUNT:
              self.assertTrue(
                  all(pval == 1 for pval, _ in pv_pcount_list)
              )
  
file_path: pipelinedp/utility_analysis/tests/data_peeker_test.py
imports: import collections
  from absl.testing import absltest
  from absl.testing import parameterized
  import pipeline_dp
  from utility_analysis import data_peeker
label_desc: Use image node_id 2 for calling the DataPeekerTest obj's underlying member method code with example usage: obj.test_sketch(metric) without return types