docstr: Test cross-validation with a group specified
docstr_tok: ["Test","cross-validation","with","a","group","specified"]
code: def test_cv(self):
      """
      Test cross-validation with a group specified
      """
      cv = xgboost.cv(
          self.params,
          self.dtrain,
          num_boost_round=2500,
          early_stopping_rounds=10,
          nfold=10,
          as_pandas=False,
      )
      assert isinstance(cv, dict)
      assert set(cv.keys()) == {
          "test-ndcg-mean",
          "train-ndcg-mean",
          "test-ndcg-std",
          "train-ndcg-std",
      }, "CV results dict key mismatch."
  
imports: import itertools
  import json
  import os
  import shutil
  from typing import Optional
  import numpy
  import pytest
  from hypothesis import given, note, settings
  from scipy.sparse import csr_matrix
  import xgboost
  from xgboost import testing
  from xgboost.testing.data import RelDataCV, simulate_clicks, sort_ltr_samples
  from xgboost.testing.params import lambdarank_parameter_strategy
label_desc: Use image node_id 4 for calling the TestRanking obj's underlying member method code with example usage: obj.test_cv() without return types