code: def _assert_categories_equals_bitset(categories, bitset):
      # assert that the bitset exactly corresponds to the categories
      # bitset is assumed to be an array of 8 uint32 elements
  
      # form bitset from threshold
      expected_bitset = np.zeros(8, dtype=np.uint32)
      for cat in categories:
          idx = cat // 32
          shift = cat % 32
          expected_bitset[idx] |= 1 << shift
  
      # check for equality
      assert_array_equal(expected_bitset, bitset)
  
file_path: scikit-learn/sklearn/ensemble/_hist_gradient_boosting/tests/test_splitting.py
imports: import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from sklearn.ensemble._hist_gradient_boosting.common import G_H_DTYPE, HISTOGRAM_DTYPE, X_BINNED_DTYPE, MonotonicConstraint
  from sklearn.ensemble._hist_gradient_boosting.histogram import HistogramBuilder
  from sklearn.ensemble._hist_gradient_boosting.splitting import Splitter, compute_node_value
  from sklearn.utils._openmp_helpers import _openmp_effective_n_threads
  from sklearn.utils._testing import skip_if_32bit
label_desc: Use image node_id 7 for calling a global function with example usage: _assert_categories_equals_bitset(categories, bitset) without return types