code: def test_error_msg() -> None:
      X, y, qid, w = tm.make_ltr(10, 2, 2, 2)
      ranker = xgboost.XGBRanker()
      with pytest.raises(
          ValueError, match=r"equal to the number of query groups"
      ):
          ranker.fit(X, y, qid=qid, sample_weight=y)
  
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 a global function with example usage: test_error_msg() without return types