class_docstr: Test image conversion outputs.
class_docstr_tok: ["Test","image","conversion","outputs","."]
code: def testConvertTruncatedImage(self):
      # Should fail with a message that image is truncated.
      # To test image truncation, we actually need to write a file to disk.
      img_filepath = os.path.join(self.testdata_dir, "test_img.png")
  
      try:
          orig_img = Image.new("RGBA", (500, 500), self.orange_rgb)
          orig_img.save(img_filepath)
          filesize = os.path.getsize(img_filepath)
  
          with open(img_filepath, "r+") as img_on_disk:
              img_on_disk.truncate(filesize - 100)
          img_truncated = Image.open(img_filepath)
  
          image_converter = convert.ImageConverter(
              img_truncated, self.conversion_settings
          )
          with self.assertRaises(IOError) as e:
              image_converter.convert()
          self.assertTrue("truncated" in str(e.exception).lower())
      except:
          raise
      finally:
          # Cleanup.
          if os.path.isfile(img_filepath):
              os.remove(img_filepath)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from absl.testing import absltest
  from PIL import Image
  from PIL import ImageColor
  import convert
label_desc: Use image node_id 14 for calling the TestImageConverterTests obj's underlying member method code with example usage: obj.testConvertTruncatedImage() without return types