code: def test_write_image(self):
      if self.file_obj:
          write_image(self.img, self.file, format=self.format)
          self.file.seek(0)
      else:
          write_image(self.img, self.file)
      img = Image.open(self.file)
  
      W, H = img.size
      self.assertEqual((H, W), self.size)
  
      if self.color:
          self.assertEqual(len(img.getbands()), 3)
      else:
          self.assertEqual(len(img.getbands()), 1)
  
      if self.format in {"bmp", "png"}:
          img = np.asarray(img)
  
          if img.ndim == 2:
              # reshape (H, W) -> (1, H, W)
              img = img[np.newaxis]
          else:
              # transpose (H, W, C) -> (C, H, W)
              img = img.transpose((2, 0, 1))
  
          np.testing.assert_equal(img, self.img)
  
file_path: chainercv/tests/utils_tests/image_tests/test_write_image.py
imports: import numpy
  from PIL import Image
  import tempfile
  import unittest
  from chainer import testing
  from chainercv.utils import write_image
label_desc: Use image node_id 2 for calling the TestWriteImage obj's underlying member method code with example usage: obj.test_write_image() without return types