code: def test_cv_explicit_fold_indices_labels(self):
      params = {
          "max_depth": 2,
          "eta": 1,
          "objective": "reg:squarederror",
      }
      N = 100
      F = 3
      dm = xgb.DMatrix(data=np.random.randn(N, F), label=np.arange(N))
      folds = [
          # Train        Test
          ([1, 3], [5, 8]),
          ([7, 9], [23, 43, 11]),
      ]
  
      # Use callback to log the test labels in each fold
      class Callback(xgb.callback.TrainingCallback):
          def __init__(self) -> None:
              super().__init__()
  
          def after_iteration(
              self,
              model,
              epoch: int,
              evals_log: xgb.callback.TrainingCallback.EvalsLog,
          ):
              print([fold.dtest.get_label() for fold in model.cvfolds])
  
      cb = Callback()
  
      # Run cross validation and capture standard out to test callback result
      with tm.captured_output() as (out, err):
          xgb.cv(
              params,
              dm,
              num_boost_round=1,
              folds=folds,
              callbacks=[cb],
              as_pandas=False,
          )
          output = out.getvalue().strip()
      solution = (
          "[array([5., 8.], dtype=float32), array([23., 43., 11.],"
          + " dtype=float32)]"
      )
      assert output == solution
  
imports: import json
  import os
  import pathlib
  import tempfile
  from pathlib import Path
  import numpy
  import pytest
  import xgboost
  from xgboost import testing
label_desc: Use image node_id 13 for calling the TestBasic obj's underlying member method code with example usage: obj.test_cv_explicit_fold_indices_labels() without return types