code: def _test(
      self,
      input_tensor,
      feature_val,
      expected_values=None,
      expected_err=None,
      create_iterator_twice=False,
  ):
      if expected_err:
          with self.assertRaisesWithPredicateMatch(
              expected_err[0], expected_err[1]
          ):
              dataset = dataset_ops.Dataset.from_tensors(
                  input_tensor
              ).apply(
                  contrib_parsing_ops.parse_example_dataset(feature_val)
              )
              get_next = self.getNext(dataset)
              self.evaluate(get_next())
          return
      else:
          # Returns dict w/ Tensors and SparseTensors.
          # Check values.
          dataset = dataset_ops.Dataset.from_tensors(
              input_tensor
          ).apply(
              contrib_parsing_ops.parse_example_dataset(feature_val)
          )
          get_next = self.getNext(dataset)
          result = self.evaluate(get_next())
          self._compare_output_to_expected(result, expected_values)
          with self.assertRaises(errors_impl.OutOfRangeError):
              self.evaluate(get_next())
          with self.assertRaises(errors_impl.OutOfRangeError):
              self.evaluate(get_next())
          if create_iterator_twice:
              get_next = self.getNext(dataset)
              result = self.evaluate(get_next())
              self._compare_output_to_expected(result, expected_values)
              with self.assertRaises(errors_impl.OutOfRangeError):
                  self.evaluate(get_next())
      # Check shapes; if serialized is a Tensor we need its size to
      # properly check.
      batch_size = (
          self.evaluate(input_tensor).size
          if isinstance(input_tensor, tensor.Tensor)
          else np.asarray(input_tensor).size
      )
      for k, f in feature_val.items():
          if (
              isinstance(f, parsing_ops.FixedLenFeature)
              and f.shape is not None
          ):
              self.assertEqual(
                  dataset_ops.get_legacy_output_shapes(dataset)[
                      k
                  ].as_list()[0],
                  batch_size,
              )
          elif isinstance(f, parsing_ops.VarLenFeature):
              self.assertEqual(
                  dataset_ops.get_legacy_output_shapes(dataset)[
                      k
                  ].as_list()[1],
                  None,
              )
  
imports: import copy
  from absl.testing import parameterized
  import numpy
  from tensorflow.core.example import example_pb2
  from tensorflow.core.example import feature_pb2
  from tensorflow.python.data.experimental.ops import parsing_ops
  from tensorflow.python.data.kernel_tests import checkpoint_test_base
  from tensorflow.python.data.kernel_tests import test_base
  from tensorflow.python.data.kernel_tests import tf_record_test_base
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.ops import options
  from tensorflow.python.eager import context
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import tensor
  from tensorflow.python.ops import parsing_ops
  from tensorflow.python.ops.ragged import ragged_factory_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 2 for calling the ParseExampleDatasetTest obj's underlying member method code with example usage: obj._test(input_tensor, feature_val, expected_values, expected_err, create_iterator_twice) without return types