docstr: Tests docstring discount factors.
docstr_tok: ["Tests","docstring","discount","factors","."]
code: def test_discount_factors(self, dtype):
      """Tests docstring discount factors."""
      # 2 and 3 year bonds with 1000 face value and 4%, 6% semi-annual coupons.
      cashflows = [[20, 20, 20, 1020, 0, 0], [30, 30, 30, 30, 30, 1030]]
      discount_factors = [
          [0.96, 0.93, 0.9, 0.87, 1.0, 1.0],
          [0.97, 0.95, 0.93, 0.9, 0.88, 0.86],
      ]
      expected_prices = [943.2, 1024.7]
      actual_prices = self.evaluate(
          tff.rates.analytics.cashflows.present_value(
              cashflows, discount_factors, dtype=dtype
          )
      )
      np.testing.assert_allclose(
          expected_prices, actual_prices, atol=1e-9
      )
  
file_path: tf-quant-finance/tf_quant_finance/rates/analytics/cashflows_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 9 for calling the CashflowsTest obj's underlying member method code with example usage: obj.test_discount_factors(dtype) without return types