code: def test_resize(
      library,
      apply_to_mask,
      size,
      duration,
      new_size,
      height,
      width,
      monkeypatch,
  ):
      """Checks ``resize`` FX behaviours using all argument and third party
      implementation combinations.
      """
      # mock implementation
      resize_fx_mod = sys.modules[resize.__module__]
      resizer_func, error_msgs = {
          "PIL": resize_fx_mod._get_PIL_resizer,
          "cv2": resize_fx_mod._get_cv2_resizer,
          "scipy": resize_fx_mod._get_scipy_resizer,
      }[library]()
  
      # if function is not available, skip test for implementation
      if error_msgs:
          pytest.skip(error_msgs[0].split(" (")[0])
      monkeypatch.setattr(resize_fx_mod, "resizer", resizer_func)
  
      # build expected sizes (using `width` or `height` arguments will be proportional
      # to original size)
      if new_size:
          if hasattr(new_size, "__call__"):
              # function
              expected_new_sizes = [
                  new_size(t) for t in range(duration)
              ]
          elif isinstance(new_size, numbers.Number):
              # scaling factor
              expected_new_sizes = [
                  [int(size[0] * new_size), int(size[1] * new_size)]
              ]
          else:
              # tuple or list
              expected_new_sizes = [new_size]
      elif height:
          if hasattr(height, "__call__"):
              expected_new_sizes = []
              for t in range(duration):
                  new_height = height(t)
                  expected_new_sizes.append(
                      [int(size[0] * new_height / size[1]), new_height]
                  )
          else:
              expected_new_sizes = [
                  [size[0] * height / size[1], height]
              ]
      elif width:
          if hasattr(width, "__call__"):
              expected_new_sizes = []
              for t in range(duration):
                  new_width = width(t)
                  expected_new_sizes.append(
                      [new_width, int(size[1] * new_width / size[0])]
                  )
          else:
              expected_new_sizes = [[width, size[1] * width / size[0]]]
      else:
          expected_new_sizes = None
  
      clip = ColorClip(size=size, color=(0, 0, 0), duration=duration)
      clip.fps = 1
      mask = ColorClip(size=size, color=0, is_mask=True)
      clip = clip.with_mask(mask)
  
      # any resizing argument passed, raises `ValueError`
      if expected_new_sizes is None:
          with pytest.raises(ValueError):
              resized_clip = clip.resize(
                  new_size=new_size,
                  height=height,
                  width=width,
                  apply_to_mask=apply_to_mask,
              )
          resized_clip = clip
          expected_new_sizes = [size]
      else:
          resized_clip = clip.resize(
              new_size=new_size,
              height=height,
              width=width,
              apply_to_mask=apply_to_mask,
          )
  
      # assert new size for each frame
      for t in range(duration):
          expected_width = expected_new_sizes[t][0]
          expected_height = expected_new_sizes[t][1]
  
          clip_frame = resized_clip.get_frame(t)
  
          assert len(clip_frame[0]) == expected_width
          assert len(clip_frame) == expected_height
  
          mask_frame = resized_clip.mask.get_frame(t)
          if apply_to_mask:
              assert len(mask_frame[0]) == expected_width
              assert len(mask_frame) == expected_height
  
imports: import decimal
  import importlib
  import math
  import numbers
  import os
  import random
  import sys
  import numpy
  import pytest
  from moviepy import AudioClip, AudioFileClip, BitmapClip, ColorClip, VideoClip, VideoFileClip
  from moviepy.audio.fx import audio_delay, audio_fadein, audio_fadeout, audio_normalize, multiply_stereo_volume, multiply_volume
  from moviepy.tools import convert_to_seconds
  from moviepy.video.fx import blackwhite, crop, even_size, fadein, fadeout, freeze, freeze_region, invert_colors, loop, lum_contrast, make_loopable, margin, mask_and, mask_or, mirror_x, mirror_y, multiply_color, multiply_speed, resize, rotate, time_mirror, time_symmetrize
label_desc: Use image node_id 23 for calling a global function with example usage: test_resize(library, apply_to_mask, size, duration, new_size, height, width, monkeypatch) without return types