code: def test_validate_params_method():
      """Check that validate_params works with methods"""
      with pytest.raises(
          InvalidParameterError,
          match="The 'a' parameter of _Class._method must be",
      ):
          _Class()._method("wrong")
  
      # validated method can be decorated
      with pytest.warns(
          FutureWarning,
          match="Function _deprecated_method is deprecated",
      ):
          with pytest.raises(
              InvalidParameterError,
              match="The 'a' parameter of _Class._deprecated_method must be",
          ):
              _Class()._deprecated_method("wrong")
  
imports: from numbers import Integral, Real
  import numpy
  import pytest
  from scipy.sparse import csr_matrix
  from sklearn.base import BaseEstimator
  from sklearn.model_selection import LeaveOneOut
  from sklearn.utils import deprecated
  from imblearn._config import config_context, get_config
  from imblearn.base import _ParamsValidationMixin
  from imblearn.utils._param_validation import HasMethods, Hidden, Interval, InvalidParameterError, MissingValues, Options, RealNotInt, StrOptions, _ArrayLikes, _Booleans, _Callables, _CVObjects, _InstancesOf, _IterablesNotString, _NoneConstraint, _PandasNAConstraint, _RandomStates, _SparseMatrices, _VerboseHelper, generate_invalid_param_val, generate_valid_param, make_constraint, validate_params
  from imblearn.utils.fixes import _fit_context
label_desc: Use image node_id 20 for calling a global function with example usage: test_validate_params_method() without return types