class_docstr: Tests for methods in newton_vol module.
class_docstr_tok: ["Tests","for","methods","in","newton_vol","module","."]
code: def test_discount_factor_correctness(self):
      dtype = np.float64
      expiries = np.array([1.0], dtype=dtype)
      rates = np.array([0.05], dtype=dtype)
      discount_factors = np.exp(-rates * expiries)
      spots = np.array([1.0], dtype=dtype)
      strikes = np.array([0.9], dtype=dtype)
      volatilities = np.array([0.13], dtype=dtype)
      is_call_options = True
  
      prices = self.evaluate(
          tff.black_scholes.option_price(
              volatilities=volatilities,
              strikes=strikes,
              expiries=expiries,
              spots=spots,
              is_call_options=is_call_options,
              discount_factors=discount_factors,
              dtype=tf.float64,
          )
      )
  
      implied_vols = self.evaluate(
          tff.black_scholes.implied_vol_newton(
              prices=prices,
              strikes=strikes,
              expiries=expiries,
              spots=spots,
              discount_factors=discount_factors,
              is_call_options=is_call_options,
              dtype=tf.float64,
              max_iterations=1000,
              tolerance=1e-8,
          )
      )[0]
  
      self.assertArrayNear(volatilities, implied_vols, 1e-7)
  
file_path: tf-quant-finance/tf_quant_finance/black_scholes/implied_vol_newton_root_test.py
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  import tf_quant_finance
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 8 for calling the ImpliedVolNewtonTest obj's underlying member method code with example usage: obj.test_discount_factor_correctness() without return types