code: def test_rank_filter():
      np.random.seed(22)
      A = np.random.randint(0, 256, (32, 32))
      Bc = np.ones((3, 3))
      for r in range(9):
          B1 = rank_filter(A, Bc, r, mode="constant")
          B2 = _slow_rank_filter(A, r)
          assert np.all(B1 == B2)
  
file_path: mahotas/mahotas/tests/test_median_filter.py
imports: import numpy
  from mahotas.convolve import median_filter, rank_filter
  import pytest
label_desc: Use image node_id 3 for calling a global function with example usage: test_rank_filter() without return types