code: def test_build_histogram(build_func):
      binned_feature = np.array(
          [0, 2, 0, 1, 2, 0, 2, 1], dtype=X_BINNED_DTYPE
      )
  
      # Small sample_indices (below unrolling threshold)
      ordered_gradients = np.array([0, 1, 3], dtype=G_H_DTYPE)
      ordered_hessians = np.array([1, 1, 2], dtype=G_H_DTYPE)
  
      sample_indices = np.array([0, 2, 3], dtype=np.uint32)
      hist = np.zeros((1, 3), dtype=HISTOGRAM_DTYPE)
      build_func(
          0,
          sample_indices,
          binned_feature,
          ordered_gradients,
          ordered_hessians,
          hist,
      )
      hist = hist[0]
      assert_array_equal(hist["count"], [2, 1, 0])
      assert_allclose(hist["sum_gradients"], [1, 3, 0])
      assert_allclose(hist["sum_hessians"], [2, 2, 0])
  
      # Larger sample_indices (above unrolling threshold)
      sample_indices = np.array([0, 2, 3, 6, 7], dtype=np.uint32)
      ordered_gradients = np.array([0, 1, 3, 0, 1], dtype=G_H_DTYPE)
      ordered_hessians = np.array([1, 1, 2, 1, 0], dtype=G_H_DTYPE)
  
      hist = np.zeros((1, 3), dtype=HISTOGRAM_DTYPE)
      build_func(
          0,
          sample_indices,
          binned_feature,
          ordered_gradients,
          ordered_hessians,
          hist,
      )
      hist = hist[0]
      assert_array_equal(hist["count"], [2, 2, 1])
      assert_allclose(hist["sum_gradients"], [1, 4, 0])
      assert_allclose(hist["sum_hessians"], [2, 2, 1])
  
file_path: scikit-learn/sklearn/ensemble/_hist_gradient_boosting/tests/test_histogram.py
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from sklearn.ensemble._hist_gradient_boosting.common import G_H_DTYPE, HISTOGRAM_DTYPE, X_BINNED_DTYPE
  from sklearn.ensemble._hist_gradient_boosting.histogram import _build_histogram, _build_histogram_naive, _build_histogram_no_hessian, _build_histogram_root, _build_histogram_root_no_hessian, _subtract_histograms
label_desc: Use image node_id 1 for calling a global function with example usage: test_build_histogram(build_func) without return types