code: def test_inject_outlier_ts(inject_outlier_ts_params):
      X, perc_outlier, min_std = inject_outlier_ts_params
      data = inject_outlier_ts(
          X, perc_outlier, perc_window=10, n_std=2.0, min_std=min_std
      )
      assert isinstance(data, Bunch)
      X_outlier, is_outlier = data.data, data.target
      assert X_outlier.shape[0] == N == is_outlier.shape[0]
      assert (
          perc_outlier - 5 < is_outlier.mean() * 100 < perc_outlier + 5
      )
      X_diff = (X_outlier != X).astype(int).sum(axis=1)
      idx_diff = np.where(X_diff != 0)[0]
      idx_outlier = np.where(is_outlier != 0)[0]
      if perc_outlier > 0:
          assert (idx_diff == idx_outlier).all()
      else:
          assert not idx_diff and not idx_outlier
  
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 4 for calling a global function with example usage: test_inject_outlier_ts(inject_outlier_ts_params) without return types