code: def test_conversion_image_to_array(self):
      feature_extractor = ImageFeatureExtractionMixin()
      image = get_random_image(16, 32)
  
      # Conversion with defaults (rescale + channel first)
      array1 = feature_extractor.to_numpy_array(image)
      self.assertTrue(array1.dtype, np.float32)
      self.assertEqual(array1.shape, (3, 16, 32))
  
      # Conversion with rescale and not channel first
      array2 = feature_extractor.to_numpy_array(
          image, channel_first=False
      )
      self.assertTrue(array2.dtype, np.float32)
      self.assertEqual(array2.shape, (16, 32, 3))
      self.assertTrue(np.array_equal(array1, array2.transpose(2, 0, 1)))
  
      # Conversion with no rescale and channel first
      array3 = feature_extractor.to_numpy_array(image, rescale=False)
      self.assertTrue(array3.dtype, np.uint8)
      self.assertEqual(array3.shape, (3, 16, 32))
      self.assertTrue(
          np.array_equal(
              array1, array3.astype(np.float32) * (1 / 255.0)
          )
      )
  
      # Conversion with no rescale and not channel first
      array4 = feature_extractor.to_numpy_array(
          image, rescale=False, channel_first=False
      )
      self.assertTrue(array4.dtype, np.uint8)
      self.assertEqual(array4.shape, (16, 32, 3))
      self.assertTrue(
          np.array_equal(
              array2, array4.astype(np.float32) * (1 / 255.0)
          )
      )
  
imports: import os
  import tempfile
  import unittest
  import datasets
  import numpy
  import pytest
  from huggingface_hub.file_download import http_get
  from requests import ConnectTimeout, ReadTimeout
  from tests.pipelines.test_pipelines_document_question_answering import INVOICE_URL
  from transformers import is_torch_available, is_vision_available
  from transformers.image_utils import ChannelDimension, get_channel_dimension_axis, make_list_of_images
  from transformers.testing_utils import is_flaky, require_torch, require_vision
label_desc: Use image node_id 1 for calling the ImageFeatureExtractionTester obj's underlying member method code with example usage: obj.test_conversion_image_to_array() without return types