code: def testNotIterable(self):
      # Tensor iteration is disabled explicitly for only graph mode.
      with ops.Graph().as_default():
          # NOTE(mrry): If we register __getitem__ as an overloaded
          # operator, Python will valiantly attempt to iterate over the
          # Tensor from 0 to infinity.  This test ensures that this
          # unintended behavior is prevented.
          c = constant_op.constant(5.0)
          with self.assertRaisesRegex(
              errors_impl.OperatorNotAllowedInGraphError,
              "Iterating over a symbolic `tf.Tensor`",
          ):
              for _ in c:
                  pass
  
imports: import numpy
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 25 for calling the SliceTest obj's underlying member method code with example usage: obj.testNotIterable() without return types