code: def testWriteTransformFnIsIdempotent(self):
      transform_output_dir = os.path.join(self.get_temp_dir(), "output")
  
      def mock_write_metadata_expand(unused_self, unused_metadata):
          raise ArithmeticError("Some error")
  
      with beam.Pipeline() as pipeline:
          # Create an empty directory for the source saved model dir.
          saved_model_dir = os.path.join(self.get_temp_dir(), "source")
          saved_model_dir_pcoll = (
              pipeline
              | "CreateSavedModelDir" >> beam.Create([saved_model_dir])
          )
  
          with mock.patch.object(
              transform_fn_io.beam_metadata_io.WriteMetadata,
              "expand",
              mock_write_metadata_expand,
          ):
              with self.assertRaisesRegexp(
                  ArithmeticError, "Some error"
              ):
                  _ = (
                      saved_model_dir_pcoll,
                      object(),
                  ) | transform_fn_io.WriteTransformFn(
                      transform_output_dir
                  )
  
      self.assertFalse(file_io.file_exists(transform_output_dir))
  
file_path: transform/tensorflow_transform/beam/tft_beam_io/transform_fn_io_test.py
imports: import os
  import apache_beam
  from apache_beam.testing import util
  import tensorflow
  import tensorflow_transform
  from tensorflow_transform.beam.tft_beam_io import beam_metadata_io
  from tensorflow_transform.beam.tft_beam_io import transform_fn_io
  from tensorflow_transform.beam import tft_unit
  from tensorflow_transform.beam.tft_beam_io import test_metadata
  from tensorflow_transform.tf_metadata import metadata_io
  from tensorflow.python.lib.io import file_io
label_desc: Use image node_id 3 for calling the TransformFnIoTest obj's underlying member method code with example usage: obj.testWriteTransformFnIsIdempotent() without return types