code: def test_dmatrix_init(self):
      data = np.random.randn(5, 5)
  
      # different length
      self.assertRaises(
          ValueError, xgb.DMatrix, data, feature_names=list("abcdef")
      )
      # contains duplicates
      self.assertRaises(
          ValueError,
          xgb.DMatrix,
          data,
          feature_names=["a", "b", "c", "d", "d"],
      )
      # contains symbol
      self.assertRaises(
          ValueError,
          xgb.DMatrix,
          data,
          feature_names=["a", "b", "c", "d", "e=1"],
      )
  
      dm = xgb.DMatrix(data)
      dm.feature_names = list("abcde")
      assert dm.feature_names == list("abcde")
  
      dm.feature_types = "q"
      assert dm.feature_types == list("qqqqq")
  
      dm.feature_types = list("qiqiq")
      assert dm.feature_types == list("qiqiq")
  
      def incorrect_type_set():
          dm.feature_types = list("abcde")
  
      self.assertRaises(ValueError, incorrect_type_set)
  
      # reset
      dm.feature_names = None
      assert dm.feature_names is None
      assert dm.feature_types is None
  
file_path: turicreate/src/external/xgboost/tests/python/test_basic.py
imports: import numpy
  import xgboost
  import unittest
  import matplotlib
label_desc: Use image node_id 2 for calling the TestBasic obj's underlying member method code with example usage: obj.test_dmatrix_init() without return types