code: def test_imsave(self):
      picdir = os.path.join(datapath, "data")
      for png in glob.iglob(picdir + "/*.png"):
          with suppress_warnings() as sup:
              # PIL causes a Py3k ResourceWarning
              sup.filter(message="unclosed file")
              sup.filter(DeprecationWarning)
              img = misc.imread(png)
          tmpdir = tempfile.mkdtemp()
          try:
              fn1 = os.path.join(tmpdir, "test.png")
              fn2 = os.path.join(tmpdir, "testimg")
              with suppress_warnings() as sup:
                  # PIL causes a Py3k ResourceWarning
                  sup.filter(message="unclosed file")
                  sup.filter(DeprecationWarning)
                  misc.imsave(fn1, img)
                  misc.imsave(fn2, img, "PNG")
  
              with suppress_warnings() as sup:
                  # PIL causes a Py3k ResourceWarning
                  sup.filter(message="unclosed file")
                  sup.filter(DeprecationWarning)
                  data1 = misc.imread(fn1)
                  data2 = misc.imread(fn2)
              assert_allclose(data1, img)
              assert_allclose(data2, img)
              assert_equal(data1.shape, img.shape)
              assert_equal(data2.shape, img.shape)
          finally:
              shutil.rmtree(tmpdir)
  
imports: from __future__ import division, print_function, absolute_import
  import os.path
  import tempfile
  import shutil
  import numpy
  import glob
  import pytest
  from pytest import raises
  from numpy.testing import assert_equal, assert_allclose, assert_array_equal, assert_
  from scipy._lib._numpy_compat import suppress_warnings
  from scipy import misc
  from numpy.ma.testutils import assert_mask_equal
label_desc: Use image node_id 15 for calling the TestPILUtil obj's underlying member method code with example usage: obj.test_imsave() without return types