code: def _optional_spec_test_combinations():
      # pylint: disable=g-long-lambda
      cases = [
          (
              "Dense",
              lambda: constant_op.constant(37.0),
              tensor_spec.TensorSpec([], dtypes.float32),
          ),
          (
              "Sparse",
              lambda: sparse_tensor.SparseTensor(
                  indices=[[0, 1]],
                  values=constant_op.constant([0], dtype=dtypes.int32),
                  dense_shape=[10, 10],
              ),
              sparse_tensor.SparseTensorSpec([10, 10], dtypes.int32),
          ),
          (
              "Nest",
              lambda: {
                  "a": constant_op.constant(37.0),
                  "b": (
                      constant_op.constant(["Foo"]),
                      constant_op.constant("Bar"),
                  ),
              },
              {
                  "a": tensor_spec.TensorSpec([], dtypes.float32),
                  "b": (
                      tensor_spec.TensorSpec([1], dtypes.string),
                      tensor_spec.TensorSpec([], dtypes.string),
                  ),
              },
          ),
          (
              "Optional",
              lambda: optional_ops.Optional.from_value(37.0),
              optional_ops.OptionalSpec(
                  tensor_spec.TensorSpec([], dtypes.float32)
              ),
          ),
      ]
  
      def reduce_fn(x, y):
          name, value_fn, expected_structure = y
          return x + combinations.combine(
              tf_value_fn=combinations.NamedObject(name, value_fn),
              expected_value_structure=expected_structure,
          )
  
      return functools.reduce(reduce_fn, cases, [])
  
imports: import functools
  from absl.testing import parameterized
  import numpy
  from tensorflow.python.data.kernel_tests import test_base
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.ops import iterator_ops
  from tensorflow.python.data.ops import optional_ops
  from tensorflow.python.data.util import structure
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import tensor_spec
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 1 for calling a global function with example usage: _optional_spec_test_combinations() and returns: functools, unknown