code: def _check_group_importance(X, y, ebm):
      term_names = ["A", "B"]
      term_indices = [0, 1]
  
      # An exception should be raised when the EBM is not fitted
      with pytest.raises(NotFittedError):
          compute_group_importance(term_names, ebm, X)
  
      ebm.fit(X, y)
  
      # An exception should be raised when at least one of the input terms is invalid
      with pytest.raises(ValueError):
          compute_group_importance(["A", "B", 10], ebm, X)
  
      with pytest.raises(ValueError):
          compute_group_importance([], ebm, X)
  
      # It should be the same for term names and indices
      assert compute_group_importance(
          term_names, ebm, X
      ) == compute_group_importance(term_indices, ebm, X)
  
      # For one term, its importance should be approx. equal to the one computed by interpret
      # TODO For multiclass this is currently consistent with interpret, but might be changed
      assert pytest.approx(
          ebm.term_importances()[0]
      ) == compute_group_importance(["A"], ebm, X)
  
      mixed_list = ["A", 1]
      assert compute_group_importance(
          ["A", "B"], ebm, X
      ) == compute_group_importance(mixed_list, ebm, X)
  
      contributions = ebm.eval_terms(X)
      assert compute_group_importance(
          term_names, ebm, X, contributions
      ) == compute_group_importance(term_names, ebm, X)
  
file_path: interpret/python/interpret-core/tests/glassbox/ebm/research/test_group_importance.py
imports: import pytest
  import warnings
  from sklearn.exceptions import NotFittedError
  from interpret.glassbox import ExplainableBoostingRegressor, ExplainableBoostingClassifier
  from ....tutils import synthetic_multiclass, synthetic_classification, synthetic_regression
  from interpret.glassbox._ebm._research._group_importance import _get_group_name
  from interpret.glassbox._ebm._research import compute_group_importance, append_group_importance, get_group_and_individual_importances, get_individual_importances, get_importance_per_top_groups
label_desc: Use image node_id 8 for calling a global function with example usage: _check_group_importance(X, y, ebm) without return types