docstr: Test constructing single image from PNG and JPEG format.
docstr_tok: ["Test","constructing","single","image","from","PNG","and","JPEG","format","."]
code: def test_construct(self):
      """
      Test constructing single image from PNG and JPEG format.
      """
      # Test construction with format hint
      for meta_info in test_image_info:
          glimage = image.Image(
              path=meta_info.url, format=meta_info.format
          )
          self.__check_raw_image_metainfo(glimage, meta_info)
  
      # Test construction with format inference
      for meta_info in test_image_info:
          glimage = image.Image(path=meta_info.url)
          self.__check_raw_image_metainfo(glimage, meta_info)
  
      # Test construction with wrong format
      for meta_info in test_image_info:
          if meta_info.url == "PNG":
              self.assertRaises(
                  RuntimeError,
                  lambda: image.Image(path=meta_info.url, format="JPG"),
              )
          elif meta_info.url == "JPG":
              self.assertRaises(
                  RuntimeError,
                  lambda: image.Image(path=meta_info.url, format="PNG"),
              )
  
      # Test empty image sarray
      sa = SArray([image.Image()] * 100)
      for i in sa:
          self.assertEqual(i.width, 0)
          self.assertEqual(i.height, 0)
          self.assertEqual(i.channels, 0)
  
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 3 for calling the ImageClassTest obj's underlying member method code with example usage: obj.test_construct() without return types