code: def testLimitingInfNanMonitorAlertCountWorks(self):
      mock_reader = test.mock.MagicMock()
      monitor = debug_events_monitors.InfNanMonitor(
          mock_reader, limit=3
      )
      for i in range(10):
          execution_digest = debug_events_reader.ExecutionDigest(
              i * 1000, 1, "FooOp", output_tensor_device_ids=[0, 1]
          )
          execution = debug_events_reader.Execution(
              execution_digest,
              "worker01",
              ["a1", "b2", "e3"],
              debug_event_pb2.TensorDebugMode.CURT_HEALTH,
              graph_id=None,
              input_tensor_ids=[12, 34],
              output_tensor_ids=[56, 78],
              debug_tensor_values=[[-1, 0], [-1, 1]],
          )  # [tensor_id, any_inf_nan].
          monitor.on_execution(i, execution)
  
      alerts = monitor.alerts()
      self.assertLen(alerts, 3)
      for i, alert in enumerate(alerts):
          self.assertEqual(alert.wall_time, i * 1000)
          self.assertEqual(alert.op_type, "FooOp")
          self.assertEqual(alert.output_slot, 1)
          # The four fields below are unavailable under CURT_HEALTH mode by design.
          self.assertIsNone(alert.size)
          self.assertIsNone(alert.num_neg_inf)
          self.assertIsNone(alert.num_pos_inf)
          self.assertIsNone(alert.num_nan)
          self.assertEqual(alert.execution_index, i)
          self.assertIsNone(alert.graph_execution_trace_index)
  
imports: from absl.testing import parameterized
  import numpy
  from tensorflow.core.protobuf import debug_event_pb2
  from tensorflow.python.debug.lib import debug_events_monitors
  from tensorflow.python.debug.lib import debug_events_reader
  from tensorflow.python.debug.lib import dumping_callback
  from tensorflow.python.debug.lib import dumping_callback_test_lib
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.platform import googletest
  from tensorflow.python.platform import test
label_desc: Use image node_id 9 for calling the InfNanMonitorTest obj's underlying member method code with example usage: obj.testLimitingInfNanMonitorAlertCountWorks() without return types