docstr: Helper function for testing RaggedTensor.__getitem__.
  
  Checks that calling `rt.__getitem__(slice_spec) returns the expected value.
  Checks three different configurations for each slice spec:
  
    * Call __getitem__ with the slice spec as-is (with int values)
    * Call __getitem__ with int values in the slice spec wrapped in
      `tf.constant()`.
    * Call __getitem__ with int values in the slice spec wrapped in
      `tf.compat.v1.placeholder()` (so value is not known at graph
      construction time).
  
  Args:
    rt: The RaggedTensor to test.
    slice_spec: The slice spec.
    expected: The expected value of rt.__getitem__(slice_spec), as a python
      list; or an exception class.
    expected_shape: The expected shape for `rt.__getitem__(slice_spec)`.
docstr_tok: ["Helper","function","for","testing","RaggedTensor.__getitem__",".","Checks","that","calling","`","rt.__getitem__","(","slice_spec",")","returns","the","expected","value",".","Checks","three","different","configurations","for","each","slice","spec",":","*","Call","__getitem__","with","the","slice","spec","as-is","(","with","int","values",")","*","Call","__getitem__","with","int","values","in","the","slice","spec","wrapped","in","`","tf.constant","(",")","`",".","*","Call","__getitem__","with","int","values","in","the","slice","spec","wrapped","in","`","tf.compat.v1.placeholder","(",")","`","(","so","value","is","not","known","at","graph","construction","time",")",".","Args",":","rt",":","The","RaggedTensor","to","test",".","slice_spec",":","The","slice","spec",".","expected",":","The","expected","value","of","rt.__getitem__","(","slice_spec",")",",","as","a","python","list",";","or","an","exception","class",".","expected_shape",":","The","expected","shape","for","`","rt.__getitem__","(","slice_spec",")","`","."]
code: def _TestGetItem(self, rt, slice_spec, expected, expected_shape=None):
      """Helper function for testing RaggedTensor.__getitem__.
  
      Checks that calling `rt.__getitem__(slice_spec) returns the expected value.
      Checks three different configurations for each slice spec:
  
        * Call __getitem__ with the slice spec as-is (with int values)
        * Call __getitem__ with int values in the slice spec wrapped in
          `tf.constant()`.
        * Call __getitem__ with int values in the slice spec wrapped in
          `tf.compat.v1.placeholder()` (so value is not known at graph
          construction time).
  
      Args:
        rt: The RaggedTensor to test.
        slice_spec: The slice spec.
        expected: The expected value of rt.__getitem__(slice_spec), as a python
          list; or an exception class.
        expected_shape: The expected shape for `rt.__getitem__(slice_spec)`.
      """
      tensor_slice_spec1 = _make_tensor_slice_spec(slice_spec, True)
      tensor_slice_spec2 = _make_tensor_slice_spec(slice_spec, False)
      value1 = rt.__getitem__(slice_spec)
      value2 = rt.__getitem__(tensor_slice_spec1)
      value3 = rt.__getitem__(tensor_slice_spec2)
      self.assertAllEqual(
          value1, expected, "slice_spec=%s" % (slice_spec,)
      )
      self.assertAllEqual(
          value2, expected, "slice_spec=%s" % (slice_spec,)
      )
      self.assertAllEqual(
          value3, expected, "slice_spec=%s" % (slice_spec,)
      )
      if expected_shape is not None:
          value1.shape.assert_is_compatible_with(expected_shape)
          value2.shape.assert_is_compatible_with(expected_shape)
          value3.shape.assert_is_compatible_with(expected_shape)
  
imports: import re
  from absl.testing import parameterized
  from tensorflow.python.eager import context
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import tensor_getitem_override
  from tensorflow.python.ops.ragged import ragged_factory_ops
  from tensorflow.python.ops.ragged.ragged_tensor import RaggedTensor
  from tensorflow.python.platform import googletest
label_desc: Use image node_id 1 for calling the RaggedGetItemTest obj's underlying member method code with example usage: obj._TestGetItem(rt, slice_spec, expected, expected_shape) without return types