code: def testBasic(self, skip, take, error=None, error_msg=None):
      def make_sparse(x):
          x_1d = array_ops.reshape(x, [1])
          x_2d = array_ops.reshape(x, [1, 1])
          return sparse_tensor.SparseTensor(x_2d, x_1d, x_1d)
  
      dataset = (
          dataset_ops.Dataset.range(100)
          .skip(skip)
          .map(lambda x: (x * x, make_sparse(x)))
          .take(take)
      )
      if error is None:
          dense_val, sparse_val = self.evaluate(
              dataset.get_single_element()
          )
          self.assertEqual(skip * skip, dense_val)
          self.assertAllEqual([[skip]], sparse_val.indices)
          self.assertAllEqual([skip], sparse_val.values)
          self.assertAllEqual([skip], sparse_val.dense_shape)
      else:
          with self.assertRaisesRegex(error, error_msg):
              self.evaluate(dataset.get_single_element())
  
file_path: tensorflow/tensorflow/python/data/kernel_tests/get_single_element_test.py
imports: from absl.testing import parameterized
  from tensorflow.python.data.kernel_tests import test_base
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
label_desc: Use image node_id 1 for calling the GetSingleElementTest obj's underlying member method code with example usage: obj.testBasic(skip, take, error, error_msg) and returns: sparse_tensor