code: def test_astype_image(self):
      import glob
  
      imagelist = glob.glob(current_file_dir + "/images/*/**")
      imageurls = SArray(imagelist)
      images = imageurls.astype(image.Image)
      self.assertEqual(images.dtype, image.Image)
      # check that we actually loaded something.
      for i in images:
          self.assertGreater(i.height, 0)
          self.assertGreater(i.width, 0)
  
      # try a bad image
      imageurls = SArray(["no_image_here", "go_away"])
      self.assertRaises(
          Exception, lambda: imageurls.astype(image.Image)
      )
      ret = imageurls.astype(image.Image, undefined_on_failure=True)
      self.assertEqual(ret[0], None)
      self.assertEqual(ret[1], None)
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import array
  import unittest
  from PIL import Image
  import os
  from ..data_structures import image
  from ..None import SArray
  from ..toolkits.image_analysis import image_analysis
  from ..toolkits._main import ToolkitError
  from .._deps import numpy, HAS_NUMPY
label_desc: Use image node_id 8 for calling the ImageClassTest obj's underlying member method code with example usage: obj.test_astype_image() without return types