class_docstr: Tests for methods in implied_vol module.
class_docstr_tok: ["Tests","for","methods","in","implied_vol","module","."]
docstr: Test algorithm raises appropriately.
docstr_tok: ["Test","algorithm","raises","appropriately","."]
code: def test_validate_raises(
      self, price, forward, strike, expiry, is_call_option
  ):
      """Test algorithm raises appropriately."""
      dtypes = [np.float32, np.float64]
      for dtype in dtypes:
          prices = np.array([price]).astype(dtype)
          forwards = np.array([forward]).astype(dtype)
          strikes = np.array([strike]).astype(dtype)
          expiries = np.array([expiry]).astype(dtype)
          is_call_options = np.array([is_call_option])
          with self.assertRaises(tf.errors.InvalidArgumentError):
              implied_vols = bs.implied_vol(
                  prices=prices,
                  strikes=strikes,
                  expiries=expiries,
                  forwards=forwards,
                  is_call_options=is_call_options,
                  validate_args=True,
                  dtype=dtype,
              )
              self.evaluate(implied_vols)
  
file_path: tf-quant-finance/tf_quant_finance/black_scholes/implied_vol_lib_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 3 for calling the ImpliedVolTest obj's underlying member method code with example usage: obj.test_validate_raises(price, forward, strike, expiry, is_call_option) without return types