code: def test_feature_score(self):
      rng = np.random.RandomState(0)
      data = rng.randn(100, 2)
      target = np.array([0, 1] * 50)
      features = ["F0"]
      with pytest.raises(ValueError):
          xgb.DMatrix(data, label=target, feature_names=features)
  
      params = {"objective": "binary:logistic"}
      dm = xgb.DMatrix(data, label=target, feature_names=["F0", "F1"])
      booster = xgb.train(params, dm, num_boost_round=1)
      # no error since feature names might be assigned before the booster seeing data
      # and booster doesn't known about the actual number of features.
      booster.feature_names = ["F0"]
      with pytest.raises(ValueError):
          booster.get_fscore()
  
      booster.feature_names = None
      # Use JSON to make sure the output has native Python type
      scores = json.loads(json.dumps(booster.get_fscore()))
      np.testing.assert_allclose(scores["f0"], 6.0)
  
imports: import json
  import os
  import pathlib
  import tempfile
  from pathlib import Path
  import numpy
  import pytest
  import xgboost
  from xgboost import testing
label_desc: Use image node_id 6 for calling the TestBasic obj's underlying member method code with example usage: obj.test_feature_score() without return types