code: def test_apply_mask(apply_mask_params):
      (
          mask_size,
          n_masks,
          channels,
          mask_type,
          clip_rng,
      ) = apply_mask_params
      X_mask, mask = apply_mask(
          x,
          mask_size=mask_size,
          n_masks=n_masks,
          channels=channels,
          mask_type=mask_type,
          clip_rng=clip_rng,
      )
      assert X_mask.shape[0] == mask.shape[0] == n_masks
      total_masked = (
          n_masks * mask_size[0] * mask_size[1] * len(channels)
      )
      if mask_type == "zero":
          assert (mask == X_mask).astype(int).sum() == total_masked
      else:
          assert (
              clip_rng[0] <= X_mask.min()
              and clip_rng[1] >= X_mask.max()
          )
          assert (
              X_mask == np.clip(x + mask, clip_rng[0], clip_rng[1])
          ).astype(int).sum() == reduce(mul, list(x.shape)) * n_masks
  
file_path: alibi-detect/alibi_detect/utils/tests/test_perturbation.py
imports: from functools import reduce
  from itertools import product
  from operator import mul
  import numpy
  import pytest
  from alibi_detect.utils.data import Bunch
  from alibi_detect.utils.perturbation import apply_mask, inject_outlier_ts
  from alibi_detect.utils.tensorflow.perturbation import mutate_categorical
label_desc: Use image node_id 2 for calling a global function with example usage: test_apply_mask(apply_mask_params) without return types