class_docstr: Base class for testing proto encoding ops.
class_docstr_tok: ["Base","class","for","testing","proto","encoding","ops","."]
code: def testBadSizesShape(self):
      if context.executing_eagerly():
          expected_error = (
              errors.InvalidArgumentError,
              r"Invalid shape for field double_value.",
          )
      else:
          expected_error = (
              ValueError,
              r"Shape must be at least rank 2 but is rank 0",
          )
      with self.assertRaisesRegexp(*expected_error):
          self.evaluate(
              self._encode_module.encode_proto(
                  sizes=1,
                  values=[np.double(1.0)],
                  message_type="tensorflow.contrib.proto.TestValue",
                  field_names=["double_value"],
              )
          )
  
file_path: tensorflow-upstream/tensorflow/python/kernel_tests/proto/encode_proto_op_test_base.py
imports: from absl.testing import parameterized
  import numpy
  from google.protobuf import text_format
  from tensorflow.python.eager import context
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.kernel_tests.proto import proto_op_test_base
  from tensorflow.python.kernel_tests.proto import test_example_pb2
  from tensorflow.python.ops import array_ops
label_desc: Use image node_id 2 for calling the EncodeProtoOpTestBase obj's underlying member method code with example usage: obj.testBadSizesShape() without return types