code: def test_pickling(tmpdir, sample_weight):
      # Make sure that predictions are the same before and after pickling. Used
      # to be a bug because sample_weights wasn't pickled and the resulting tree
      # would miss some info.
  
      kde = KernelDensity()
      data = np.reshape([1.0, 2.0, 3.0], (-1, 1))
      kde.fit(data, sample_weight=sample_weight)
  
      X = np.reshape([1.1, 2.1], (-1, 1))
      scores = kde.score_samples(X)
  
      file_path = str(tmpdir.join("dump.pkl"))
      joblib.dump(kde, file_path)
      kde = joblib.load(file_path)
      scores_pickled = kde.score_samples(X)
  
      assert_allclose(scores, scores_pickled)
  
imports: import joblib
  import numpy
  import pytest
  from sklearn.datasets import make_blobs
  from sklearn.exceptions import NotFittedError
  from sklearn.model_selection import GridSearchCV
  from sklearn.neighbors import KDTree, KernelDensity, NearestNeighbors
  from sklearn.neighbors._ball_tree import kernel_norm
  from sklearn.pipeline import make_pipeline
  from sklearn.preprocessing import StandardScaler
  from sklearn.utils._testing import assert_allclose
label_desc: Use image node_id 10 for calling a global function with example usage: test_pickling(tmpdir, sample_weight) without return types