docstr: Retrieve the group number from the dmatrix
docstr_tok: ["Retrieve","the","group","number","from","the","dmatrix"]
code: def test_get_group(self):
      """
      Retrieve the group number from the dmatrix
      """
      # test the new getter
      self.dtrain.get_uint_info("group_ptr")
  
      for d, qid in [
          (self.dtrain, self.qid_train),
          (self.dvalid, self.qid_valid),
          (self.dtest, self.qid_test),
      ]:
          # size of each group
          group_sizes = np.array(
              [
                  len(list(items))
                  for _key, items in itertools.groupby(qid)
              ]
          )
          # indexes of group boundaries
          group_limits = d.get_uint_info("group_ptr")
          assert len(group_limits) == len(group_sizes) + 1
          assert np.array_equal(np.diff(group_limits), group_sizes)
          assert np.array_equal(
              group_sizes, np.diff(d.get_uint_info("group_ptr"))
          )
          assert np.array_equal(
              group_sizes, np.diff(d.get_uint_info("group_ptr"))
          )
          assert np.array_equal(
              group_limits, d.get_uint_info("group_ptr")
          )
  
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 6 for calling the TestRanking obj's underlying member method code with example usage: obj.test_get_group() without return types