code: def testInfNan(self):
      self._compare(np.inf, np.float32, np.inf, False)
      self._compare(np.inf, np.float64, np.inf, False)
      self._compare(-np.inf, np.float32, -np.inf, False)
      self._compare(-np.inf, np.float64, -np.inf, False)
      self.assertAllEqual(
          np.isnan(self._cast(np.nan, np.float32, False)), True
      )
      self.assertAllEqual(
          np.isnan(self._cast(np.nan, np.float64, False)), True
      )
  
      self._compare(np.inf, np.float32, np.inf, True)
      self._compare(np.inf, np.float64, np.inf, True)
      self._compare(-np.inf, np.float32, -np.inf, True)
      self._compare(-np.inf, np.float64, -np.inf, True)
      self.assertAllEqual(
          np.isnan(self._cast(np.nan, np.float32, True)), True
      )
      self.assertAllEqual(
          np.isnan(self._cast(np.nan, np.float64, True)), True
      )
  
imports: import numpy
  from tensorflow.python.eager import context
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_state_ops
  from tensorflow.python.ops import gradient_checker_v2
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
label_desc: Use image node_id 13 for calling the CastOpTest obj's underlying member method code with example usage: obj.testInfNan() without return types