code: def test_images_with_invalid_shape(
      self, make_lib_fail, dtypes, channels
  ):
      dtype, np_dtype = dtypes
      with make_lib_fail() as failing_lib:
          if _unsupported_images_for_pil(np_dtype, failing_lib):
              return
          invalid_number_of_dimensions = testing.FeatureExpectationItem(
              value=randint(256, size=(128, 128), dtype=np_dtype),
              raise_cls=ValueError,
              raise_cls_np=ValueError,
              raise_msg="must have the same rank",
          )
          invalid_number_of_channels = testing.FeatureExpectationItem(
              value=randint(256, size=(128, 128, 1), dtype=np_dtype),
              raise_cls=ValueError,
              raise_cls_np=ValueError,
              raise_msg="are incompatible",
          )
          self.assertFeature(
              feature=features_lib.Image(
                  shape=(None, None, channels), dtype=dtype
              ),
              shape=(None, None, channels),
              dtype=dtype,
              tests=[
                  invalid_number_of_dimensions,
                  invalid_number_of_channels,
              ],
              test_attributes=dict(
                  _encoding_format=None,
                  _use_colormap=False,
              ),
          )
  
imports: import contextlib
  import enum
  import os
  import pathlib
  from typing import Optional, Type
  from absl.testing import parameterized
  import numpy
  import PIL
  import pytest
  import tensorflow
  import tensorflow_datasets
  from tensorflow_datasets import testing
  from tensorflow_datasets.core import features
label_desc: Use image node_id 2 for calling the ImageFeatureTest obj's underlying member method code with example usage: obj.test_images_with_invalid_shape(make_lib_fail, dtypes, channels) without return types