code: def test_to_csr(
      self, n_samples: int, n_features: int, sparsity: float
  ) -> None:
      csr, y = make_sparse_regression(
          n_samples, n_features, sparsity, False
      )
      csr = csr.astype(np.float32)
      qdm = xgb.QuantileDMatrix(data=csr, label=y)
      ret = qdm.get_data()
      np.testing.assert_equal(csr.indptr, ret.indptr)
      np.testing.assert_equal(csr.indices, ret.indices)
  
      booster = xgb.train({"tree_method": "hist"}, dtrain=qdm)
  
      np.testing.assert_allclose(
          booster.predict(qdm),
          booster.predict(xgb.DMatrix(qdm.get_data())),
      )
  
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 11 for calling the TestQuantileDMatrix obj's underlying member method code with example usage: obj.test_to_csr(n_samples, n_features, sparsity) without return types