code: def testExampleCount(self, model_name, output_name, example_weighted):
      metric = example_count.ExampleCount().computations(
          model_names=[model_name],
          output_names=[output_name],
          example_weighted=example_weighted,
      )[0]
  
      example0 = {
          "labels": None,
          "predictions": None,
          "example_weights": [0.0],
      }
      example1 = {
          "labels": None,
          "predictions": None,
          "example_weights": [0.5],
      }
      example2 = {
          "labels": None,
          "predictions": None,
          "example_weights": [1.0],
      }
      example3 = {
          "labels": None,
          "predictions": None,
          "example_weights": [0.7],
      }
  
      if output_name:
          example0["example_weights"] = {
              output_name: example0["example_weights"]
          }
          example1["example_weights"] = {
              output_name: example1["example_weights"]
          }
          example2["example_weights"] = {
              output_name: example2["example_weights"]
          }
          example3["example_weights"] = {
              output_name: example3["example_weights"]
          }
  
      if model_name:
          example0["example_weights"] = {
              model_name: example0["example_weights"]
          }
          example1["example_weights"] = {
              model_name: example1["example_weights"]
          }
          example2["example_weights"] = {
              model_name: example2["example_weights"]
          }
          example3["example_weights"] = {
              model_name: example3["example_weights"]
          }
  
      with beam.Pipeline() as pipeline:
          # pylint: disable=no-value-for-parameter
          result = (
              pipeline
              | "Create"
              >> beam.Create([example0, example1, example2, example3])
              | "Process"
              >> beam.Map(metric_util.to_standard_metric_inputs)
              | "AddSlice" >> beam.Map(lambda x: ((), x))
              | "ComputeMetric" >> beam.CombinePerKey(metric.combiner)
          )
  
          # pylint: enable=no-value-for-parameter
  
          def check_result(got):
              try:
                  self.assertLen(got, 1)
                  got_slice_key, got_metrics = got[0]
                  self.assertEqual(got_slice_key, ())
                  example_count_key = metric_types.MetricKey(
                      name="example_count",
                      model_name=model_name,
                      output_name=output_name,
                      example_weighted=example_weighted,
                  )
                  if example_weighted:
                      self.assertDictElementsAlmostEqual(
                          got_metrics,
                          {example_count_key: (0.0 + 0.5 + 1.0 + 0.7)},
                      )
                  else:
                      self.assertDictElementsAlmostEqual(
                          got_metrics,
                          {example_count_key: (1.0 + 1.0 + 1.0 + 1.0)},
                      )
  
              except AssertionError as err:
                  raise util.BeamAssertException(err)
  
          util.assert_that(result, check_result, label="result")
  
file_path: model-analysis/tensorflow_model_analysis/metrics/example_count_test.py
imports: from absl.testing import parameterized
  import apache_beam
  from apache_beam.testing import util
  import numpy
  import tensorflow
  import tensorflow_model_analysis
  from tensorflow_model_analysis.eval_saved_model import testutil
  from tensorflow_model_analysis.metrics import example_count
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from google.protobuf import text_format
label_desc: Use image node_id 1 for calling the ExampleCountTest obj's underlying member method code with example usage: obj.testExampleCount(model_name, output_name, example_weighted) without return types