code: def test_ice_sampling(n_ice):
      """Test if the ice sampling helper function works properly when the arguments are valid."""
      n_samples, n_values = 100, 10
      ice_vals = np.random.randn(n_values, n_samples)
  
      if n_ice == "all":
          ice_sampled_vals = _sample_ice(
              ice_values=ice_vals, n_ice=n_ice
          )
          np.testing.assert_allclose(ice_vals, ice_sampled_vals)
  
      elif n_ice == "list":
          size = np.random.randint(1, n_samples)
          # needs to be sorted because of the np.unique applied inside the _sample_ice
          n_ice = np.sort(
              np.random.choice(n_samples, size=size, replace=False)
          ).tolist()
          ice_sampled_vals = _sample_ice(
              ice_values=ice_vals, n_ice=n_ice
          )
          np.testing.assert_allclose(
              ice_vals[:, n_ice], ice_sampled_vals
          )
  
      else:
          n_ice = np.random.randint(1, n_samples)
          ice_sampled_vals = _sample_ice(
              ice_values=ice_vals, n_ice=n_ice
          )
          assert ice_sampled_vals.shape[1] == n_ice
  
imports: import re
  import sys
  from copy import deepcopy
  from typing import Dict, List, Optional, Tuple, Union
  from packaging import version
  import matplotlib.pyplot
  import numpy
  import pandas
  import pytest
  from pytest_lazyfixture import lazy_fixture
  from sklearn.base import BaseEstimator
  from sklearn.datasets import make_classification
  from sklearn.ensemble import GradientBoostingClassifier
  from sklearn.exceptions import NotFittedError
  from sklearn.inspection import partial_dependence
  from sklearn.model_selection import train_test_split
  from sklearn.multioutput import MultiOutputClassifier
  from sklearn.pipeline import Pipeline
  from sklearn.utils import Bunch, shuffle
  import sklearn
  from alibi.api.defaults import DEFAULT_DATA_PD, DEFAULT_META_PD
  from alibi.api.interfaces import Explanation
  from alibi.explainers import PartialDependence, TreePartialDependence, plot_pd
  from alibi.explainers.partial_dependence import _plot_one_pd_cat, _plot_one_pd_num, _plot_two_pd_cat_cat, _plot_two_pd_num_cat, _plot_two_pd_num_num, _process_pd_ice, _sample_ice
label_desc: Use image node_id 40 for calling a global function with example usage: test_ice_sampling(n_ice) without return types