code: def test_ltr(self) -> None:
      X, y, qid, w = make_ltr(100, 3, 3, 5)
      Xy_qdm = xgb.QuantileDMatrix(X, y, qid=qid, weight=w)
      Xy = xgb.DMatrix(X, y, qid=qid, weight=w)
      xgb.train({"tree_method": "hist", "objective": "rank:ndcg"}, Xy)
  
      from_qdm = xgb.QuantileDMatrix(X, weight=w, ref=Xy_qdm)
      from_dm = xgb.QuantileDMatrix(X, weight=w, ref=Xy)
      assert predictor_equal(from_qdm, from_dm)
  
imports: from typing import Any, Dict, List
  import numpy
  import pytest
  from hypothesis import given, settings, strategies
  from scipy import sparse
  import xgboost
  from xgboost.testing import IteratorForTest, make_batches, make_batches_sparse, make_categorical, make_ltr, make_sparse_regression, predictor_equal
  from xgboost.testing.data import check_inf, np_dtypes
  from xgboost.testing.data_iter import run_mixed_sparsity
label_desc: Use image node_id 9 for calling the TestQuantileDMatrix obj's underlying member method code with example usage: obj.test_ltr() without return types