code: def testFindsRootForFlatFunction(self):
      # Flat in the [-0.5, 0.5] range.
      objective_fn = lambda x: 0 if x == 0 else x * exp(-1 / x**2)
  
      left_bracket = [-10]
      right_bracket = [1]
      expected_num_iterations = [13]
  
      expected_num_iterations, result = self.evaluate(
          [
              tf.constant(expected_num_iterations, dtype=tf.int32),
              brentq(
                  objective_fn,
                  tf.constant(left_bracket, dtype=tf.float64),
                  tf.constant(right_bracket, dtype=tf.float64),
              ),
          ]
      )
  
      _, value_at_roots, num_iterations, _ = result
  
      # Simply check that the objective function is close to the root for the
      # returned estimate. Do not check the estimate itself.
      # Unlike Brent's original algorithm (and the SciPy implementation), this
      # implementation stops the search as soon as a good enough root estimate is
      # found. As a result, the estimate may significantly differ from the one
      # returned by SciPy for functions which are extremely flat around the root.
      self.assertAllClose(value_at_roots, [0.0])
      self.assertAllEqual(num_iterations, expected_num_iterations)
  
imports: import math
  import tensorflow.compat.v2
  import tf_quant_finance
  from tensorflow.python.framework import test_util
  from tf_quant_finance.math.root_search import utils
label_desc: Use image node_id 7 for calling the BrentqTest obj's underlying member method code with example usage: obj.testFindsRootForFlatFunction() without return types