code: def test_pad():
      # Same ratio
      im = hopper()
      new_size = (im.width * 2, im.height * 2)
      new_im = ImageOps.pad(im, new_size)
      assert new_im.size == new_size
  
      for label, color, new_size in [
          ("h", None, (im.width * 4, im.height * 2)),
          ("v", "#f00", (im.width * 2, im.height * 4)),
      ]:
          for i, centering in enumerate([(0, 0), (0.5, 0.5), (1, 1)]):
              new_im = ImageOps.pad(
                  im, new_size, color=color, centering=centering
              )
              assert new_im.size == new_size
  
              assert_image_similar_tofile(
                  new_im,
                  "Tests/images/imageops_pad_"
                  + label
                  + "_"
                  + str(i)
                  + ".jpg",
                  6,
              )
  
imports: from __future__ import annotations
  import pytest
  from PIL import Image, ImageDraw, ImageOps, ImageStat, features
  from .helper import assert_image_equal, assert_image_similar, assert_image_similar_tofile, assert_tuple_approx_equal, hopper
label_desc: Use image node_id 7 for calling a global function with example usage: test_pad() without return types