code: def test_encode_error(
      self,
      feature_spec,
      instance,
      error_msg,
      error_type=ValueError,
      **kwargs,
  ):
      schema = schema_utils.schema_from_feature_spec(feature_spec)
      with self.assertRaisesRegexp(error_type, error_msg):
          coder = example_proto_coder.ExampleProtoCoder(
              schema, **kwargs
          )
          coder.encode(instance)
  
imports: import copy
  import os
  import pickle
  import sys
  from absl import flags
  import numpy
  import tensorflow
  from tensorflow_transform.coders import example_proto_coder
  from tensorflow_transform import test_case
  from tensorflow_transform.tf_metadata import schema_utils
  from google.protobuf.internal import api_implementation
  from google.protobuf import text_format
label_desc: Use image node_id 5 for calling the ExampleProtoCoderTest obj's underlying member method code with example usage: obj.test_encode_error(feature_spec, instance, error_msg, error_type) without return types