class_docstr: Test for cases in which enable_check_numerics() catches infs or nans.
class_docstr_tok: ["Test","for","cases","in","which","enable_check_numerics","(",")","catches","infs","or","nans","."]
code: def testEagerModeUsesCorrectPathLengthAndStackHeightLimits(self):
      check_numerics_callback.enable_check_numerics(
          stack_height_limit=123, path_length_limit=1200
      )
      fake_get_check_numerics_error_message = test.mock.MagicMock(
          return_value="dummy_message"
      )
      with test.mock.patch.object(
          check_numerics_callback,
          "get_check_numerics_error_message",
          fake_get_check_numerics_error_message,
      ):
          x = constant_op.constant(2.0)
          y = constant_op.constant(0.0)
          self._assertRaisesInvalidArgumentErrorAndGetMessage(
              lambda: x / y
          )  # Expected to generate an inf.
          (
              _,
              call_kwargs,
          ) = fake_get_check_numerics_error_message.call_args
          self.assertEqual(call_kwargs["stack_height_limit"], 123)
          self.assertEqual(call_kwargs["path_length_limit"], 1200)
  
imports: import re
  import numpy
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.debug.lib import check_numerics_callback
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import context
  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 errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_grad
  from tensorflow.python.ops import custom_gradient
  from tensorflow.python.ops import gen_nn_ops
  from tensorflow.python.ops import gradient_checker_v2
  from tensorflow.python.ops import math_grad
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import googletest
  from tensorflow.python.platform import test
label_desc: Use image node_id 14 for calling the CheckNumericsCallbackUnhealthyTest obj's underlying member method code with example usage: obj.testEagerModeUsesCorrectPathLengthAndStackHeightLimits() without return types