code: def test_check_booster_args():
      x, y = np.random.random((10, 2)), np.random.randint(2, size=10)
      regressor = XGBRegressor().fit(x, y)
      classifier = XGBClassifier().fit(x, y)
      booster, is_regression = _check_booster_args(regressor)
      assert is_regression is True
      assert isinstance(booster, xgboost.Booster)
      _, is_regression = _check_booster_args(
          regressor, is_regression=True
      )
      assert is_regression is True
      _, is_regression = _check_booster_args(classifier)
      assert is_regression is False
      _, is_regression = _check_booster_args(
          classifier, is_regression=False
      )
      assert is_regression is False
      with pytest.raises(ValueError):
          _check_booster_args(classifier, is_regression=True)
      with pytest.raises(ValueError):
          _check_booster_args(regressor, is_regression=False)
      booster = xgboost.Booster()
      _booster, is_regression = _check_booster_args(booster)
      assert _booster is booster
      assert is_regression is None
      _, is_regression = _check_booster_args(
          booster, is_regression=True
      )
      assert is_regression is True
  
imports: from __future__ import absolute_import
  import pytest
  import numpy
  import scipy.sparse
  from sklearn.feature_extraction.text import CountVectorizer
  import xgboost
  from xgboost import XGBClassifier, XGBRegressor
  from sklearn.pipeline import FeatureUnion
  from sklearn.preprocessing import FunctionTransformer
  from eli5.xgboost import _parse_tree_dump, _xgb_n_targets, _missing_values_set_to_nan, _parent_value, _parse_dump_line, _check_booster_args
  from eli5.explain import explain_prediction, explain_weights
  from eli5.formatters.text import format_as_text
  from eli5.formatters import fields
  from .utils import format_as_all, get_all_features, check_targets_scores
  from .test_sklearn_explain_weights import test_explain_tree_classifier, test_explain_random_forest_and_tree_feature_filter, test_feature_importances_no_remaining, assert_tree_classifier_explained
  from .test_sklearn_explain_prediction import assert_linear_regression_explained, assert_trained_linear_regression_explained, assert_explain_prediction_single_target, test_explain_clf_binary_iris, test_explain_prediction_pandas
label_desc: Use image node_id 26 for calling a global function with example usage: test_check_booster_args() without return types