code: def test_get_feature_names():
      docs = ["hello world", "hello", "world"]
  
      def _names(*args, **kwargs):
          return set(get_feature_names(*args, **kwargs))
  
      for y in [[0, 1, 2], [0, 1, 0]]:  # multiclass, binary
          vec = CountVectorizer()
          X = vec.fit_transform(docs)
  
          clf = LogisticRegression()
          clf.fit(X, y)
  
          fnames = get_feature_names(clf, vec)
          assert isinstance(fnames, FeatureNames)
          assert repr(fnames) == "<FeatureNames: 2 features with bias>"
          assert _names(clf, vec) == {"hello", "world", "<BIAS>"}
          assert _names(clf, vec, "B") == {"hello", "world", "B"}
          assert _names(clf) == {"x0", "x1", "<BIAS>"}
          assert _names(clf, feature_names=["a", "b"]) == {
              "a",
              "b",
              "<BIAS>",
          }
          assert _names(
              clf, feature_names=["a", "b"], bias_name="bias"
          ) == {"a", "b", "bias"}
          assert _names(clf, feature_names=np.array(["a", "b"])) == {
              "a",
              "b",
              "<BIAS>",
          }
          assert _names(
              clf, feature_names=FeatureNames(["a", "b"])
          ) == {"a", "b", "<BIAS>"}
          assert _names(
              clf,
              feature_names=FeatureNames(
                  n_features=2, unkn_template="F%d"
              ),
          ) == {"F0", "F1", "<BIAS>"}
  
          with pytest.raises(ValueError):
              get_feature_names(clf, feature_names=["a"])
  
          with pytest.raises(ValueError):
              get_feature_names(clf, feature_names=["a", "b", "c"])
  
          with pytest.raises(ValueError):
              get_feature_names(
                  clf, feature_names=FeatureNames(["a", "b", "c"])
              )
  
          clf2 = LogisticRegression(fit_intercept=False)
          clf2.fit(X, y)
          assert _names(clf2, vec) == {"hello", "world"}
          assert _names(clf2, feature_names=["hello", "world"]) == {
              "hello",
              "world",
          }
  
imports: from __future__ import absolute_import
  import numpy
  import pytest
  from sklearn.datasets import make_classification, make_regression
  from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
  from sklearn.linear_model import LogisticRegression, ElasticNet, SGDRegressor
  from sklearn.ensemble import RandomForestClassifier
  from sklearn.linear_model import SGDClassifier
  from sklearn.naive_bayes import GaussianNB, BernoulliNB
  from sklearn.tree import DecisionTreeClassifier
  from sklearn.multiclass import OneVsRestClassifier
  from eli5._feature_names import FeatureNames
  from eli5.sklearn.utils import get_feature_names, get_default_target_names, has_intercept, is_multiclass_classifier, is_multitarget_regressor, get_num_features
  from .utils import SGD_KWARGS
label_desc: Use image node_id 4 for calling a global function with example usage: test_get_feature_names() and returns: set