code: def testIfWithDefun(self):
      # Defun should only be used in graph mode
      with ops.Graph().as_default():
  
          @function.Defun(dtypes.float32)
          def Then(x):
              return x + 1
  
          @function.Defun(dtypes.float32)
          def Else(x):
              return x - 1
  
          inputs = [10.0]
          result = self.evaluate(
              functional_ops.If(False, inputs, Then, Else)
          )
          self.assertEqual([9.0], result)
  
file_path: tensorflow-upstream/tensorflow/python/ops/functional_ops_test.py
imports: from tensorflow.python.eager import def_function
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import function
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import tensor_spec
  from tensorflow.python.ops import functional_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 1 for calling the FunctionalOpsTest obj's underlying member method code with example usage: obj.testIfWithDefun() and returns: unknown, unknown