code: def test_permutation_evaluator():
      test_df = pd.DataFrame(
          {"a": [1, 1, 0], "bb": [2, 0, 0], "target": [0, 1, 2]}
      )
  
      base_eval = r2_evaluator
  
      def fake_predict(df):
          return df.assign(prediction=[0.5, 0.9, 1.5])
  
      expected_results = {"r2_evaluator__target": 0.745}
  
      pimp1 = permutation_evaluator(
          test_df,
          fake_predict,
          base_eval,
          features=["a"],
          baseline=True,
          shuffle_all_at_once=False,
      )
  
      assert pimp1["permutation_importance"]["a"] == expected_results
      assert (
          pimp1["permutation_importance_baseline"] == expected_results
      )
  
      pimp2 = permutation_evaluator(
          test_df,
          fake_predict,
          base_eval,
          features=["a", "bb"],
          baseline=False,
          shuffle_all_at_once=False,
      )
  
      assert pimp2["permutation_importance"]["a"] == expected_results
      assert pimp2["permutation_importance"]["bb"] == expected_results
  
      pimp3 = permutation_evaluator(
          test_df,
          fake_predict,
          base_eval,
          features=["a", "bb"],
          baseline=True,
          shuffle_all_at_once=True,
      )
  
      assert pimp3["permutation_importance"]["a-bb"] == expected_results
      assert (
          pimp3["permutation_importance_baseline"] == expected_results
      )
  
      test_df2 = pd.DataFrame(
          {
              "abc": np.linspace(0, 1, 100),
              "abcd": 1.0 - np.linspace(0, 1, 100),
              "target": np.ones(100),
          }
      )
  
      def fake_predict2(df):
          return df.assign(prediction=df["abc"] + df["abcd"])
  
      expected_results2 = {"r2_evaluator__target": 1.0}
  
      pimp4 = permutation_evaluator(
          test_df2,
          fake_predict2,
          base_eval,
          features=["abc"],
          baseline=True,
          shuffle_all_at_once=False,
          random_state=0,
      )
  
      assert pimp4["permutation_importance"]["abc"] != expected_results2
      assert (
          pimp4["permutation_importance_baseline"] == expected_results2
      )
  
imports: import sys
  import string
  import numpy
  import pandas
  import pytest
  from fklearn.validation.evaluators import auc_evaluator, brier_score_evaluator, combined_evaluators, correlation_evaluator, expected_calibration_error_evaluator, fbeta_score_evaluator, hash_evaluator, logloss_evaluator, mean_prediction_evaluator, mse_evaluator, permutation_evaluator, pr_auc_evaluator, precision_evaluator, r2_evaluator, recall_evaluator, roc_auc_evaluator, spearman_evaluator, linear_coefficient_evaluator, ndcg_evaluator, split_evaluator, temporal_split_evaluator, exponential_coefficient_evaluator, logistic_coefficient_evaluator
label_desc: Use image node_id 21 for calling a global function with example usage: test_permutation_evaluator() and returns: df, df