code: def test_num_parallel_tree():
      from sklearn.datasets import load_diabetes
  
      reg = xgb.XGBRegressor(
          n_estimators=4, num_parallel_tree=4, tree_method="hist"
      )
      X, y = load_diabetes(return_X_y=True)
      bst = reg.fit(X=X, y=y)
      dump = bst.get_booster().get_dump(dump_format="json")
      assert len(dump) == 16
  
      reg = xgb.XGBRFRegressor(n_estimators=4)
      bst = reg.fit(X=X, y=y)
      dump = bst.get_booster().get_dump(dump_format="json")
      assert len(dump) == 4
  
      config = json.loads(bst.get_booster().save_config())
      assert (
          int(
              config["learner"]["gradient_booster"][
                  "gbtree_model_param"
              ]["num_parallel_tree"]
          )
          == 4
      )
  
imports: import json
  import os
  import pickle
  import random
  import tempfile
  import warnings
  from typing import Callable, Optional
  import numpy
  import pytest
  from sklearn.utils.estimator_checks import parametrize_with_checks
  import xgboost
  from xgboost import testing
  from xgboost.testing.ranking import run_ranking_categorical, run_ranking_qid_df
  from xgboost.testing.shared import get_feature_weights, validate_data_initialization
  from xgboost.testing.updater import get_basescore
label_desc: Use image node_id 13 for calling a global function with example usage: test_num_parallel_tree() without return types