class_docstr: Tests for constructing DMatrix from data structure conforming Apache
  Arrow specification.
class_docstr_tok: ["Tests","for","constructing","DMatrix","from","data","structure","conforming","Apache","Arrow","specification","."]
code: def test_cupy_categorical(self):
      n_features = 10
      X, y = tm.make_categorical(
          10, n_features, n_categories=4, onehot=False
      )
      X = cp.asarray(X.values.astype(cp.float32))
      y = cp.array(y)
      feature_types = ["c"] * n_features
  
      assert isinstance(X, cp.ndarray)
      Xy = xgb.DMatrix(X, y, feature_types=feature_types)
      np.testing.assert_equal(
          np.array(Xy.feature_types), np.array(feature_types)
      )
  
imports: import json
  import numpy
  import pytest
  import xgboost
  from xgboost import testing
  from xgboost.testing.data import run_base_margin_info
label_desc: Use image node_id 8 for calling the TestFromCupy obj's underlying member method code with example usage: obj.test_cupy_categorical() without return types