code: def test_modefilter(mode, expected):
      im = Image.new(mode, (3, 3), None)
      im.putdata(list(range(9)))
      # image is:
      #   0 1 2
      #   3 4 5
      #   6 7 8
      mod = im.filter(ImageFilter.ModeFilter).getpixel((1, 1))
      im.putdata([0, 0, 1, 2, 5, 1, 5, 2, 0])  # mode=0
      mod2 = im.filter(ImageFilter.ModeFilter).getpixel((1, 1))
      assert (mod, mod2) == expected
  
file_path: pillow/Tests/test_image_filter.py
imports: from __future__ import annotations
  import pytest
  from PIL import Image, ImageFilter
  from .helper import assert_image_equal, hopper
label_desc: Use image node_id 4 for calling a global function with example usage: test_modefilter(mode, expected) without return types