code: def testResizeAgainstPIL(
      self, dtype, image_shape, target_shape, method
  ):
      rng = jtu.rand_uniform(self.rng())
      args_maker = lambda: (rng(image_shape, dtype),)
  
      def pil_fn(x):
          pil_methods = {
              "nearest": PIL_Image.Resampling.NEAREST,
              "bilinear": PIL_Image.Resampling.BILINEAR,
              "bicubic": PIL_Image.Resampling.BICUBIC,
              "lanczos3": PIL_Image.Resampling.LANCZOS,
          }
          img = PIL_Image.fromarray(x.astype(np.float32))
          out = np.asarray(
              img.resize(target_shape[::-1], pil_methods[method]),
              dtype=dtype,
          )
          return out
  
      if (
          image_shape == [6, 4]
          and target_shape == [33, 17]
          and method == "nearest"
      ):
          # TODO(phawkins): I suspect we're simply handling ties differently for
          # this test case.
          raise unittest.SkipTest("Test fails")
      jax_fn = partial(
          image.resize,
          shape=target_shape,
          method=method,
          antialias=True,
      )
      self._CheckAgainstNumpy(
          pil_fn, jax_fn, args_maker, check_dtypes=True, atol=3e-5
      )
  
imports: from functools import partial
  import unittest
  import numpy
  from absl.testing import absltest
  import jax
  from jax import image
  from jax import numpy
  from jax._src import test_util
  from jax import config
label_desc: Use image node_id 2 for calling the ImageTest obj's underlying member method code with example usage: obj.testResizeAgainstPIL(dtype, image_shape, target_shape, method) and returns: out