docstr: Download and setup the test fixtures
docstr_tok: ["Download","and","setup","the","test","fixtures"]
code: def setup_class(cls):
      """
      Download and setup the test fixtures
      """
      cls.dpath = "demo/rank/"
      (
          x_train,
          y_train,
          qid_train,
          x_test,
          y_test,
          qid_test,
          x_valid,
          y_valid,
          qid_valid,
      ) = tm.data.get_mq2008(cls.dpath)
  
      # instantiate the matrices
      cls.dtrain = xgboost.DMatrix(x_train, y_train)
      cls.dvalid = xgboost.DMatrix(x_valid, y_valid)
      cls.dtest = xgboost.DMatrix(x_test, y_test)
      # set the group counts from the query IDs
      cls.dtrain.set_group(
          [
              len(list(items))
              for _key, items in itertools.groupby(qid_train)
          ]
      )
      cls.dtest.set_group(
          [
              len(list(items))
              for _key, items in itertools.groupby(qid_test)
          ]
      )
      cls.dvalid.set_group(
          [
              len(list(items))
              for _key, items in itertools.groupby(qid_valid)
          ]
      )
      # save the query IDs for testing
      cls.qid_train = qid_train
      cls.qid_test = qid_test
      cls.qid_valid = qid_valid
  
      # model training parameters
      cls.params = {
          "objective": "rank:pairwise",
          "booster": "gbtree",
          "eval_metric": ["ndcg"],
      }
  
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 1 for calling the TestRanking obj's underlying member method code with example usage: obj.setup_class(cls) without return types