code: def test_formats(self, mode, resample):
      im = hopper(mode)
      box = (20, 20, im.size[0] - 20, im.size[1] - 20)
      with_box = im.resize((32, 32), resample, box)
      cropped = im.crop(box).resize((32, 32), resample)
      assert_image_similar(cropped, with_box, 0.4)
  
imports: from __future__ import annotations
  from contextlib import contextmanager
  import pytest
  from PIL import Image, ImageDraw
  from .helper import assert_image_equal, assert_image_similar, hopper, mark_if_feature_version
label_desc: Use image node_id 5 for calling the TestCoreResampleBox obj's underlying member method code with example usage: obj.test_formats(mode, resample) without return types