code: def test_bin_mapper_small_random_data(n_samples, max_bins):
      data = (
          np.random.RandomState(42)
          .normal(size=n_samples)
          .reshape(-1, 1)
      )
      assert len(np.unique(data)) == n_samples
  
      # max_bins is the number of bins for non-missing values
      n_bins = max_bins + 1
      mapper = _BinMapper(n_bins=n_bins, random_state=42)
      binned = mapper.fit_transform(data)
  
      assert binned.shape == data.shape
      assert binned.dtype == np.uint8
      assert_array_equal(
          binned.ravel()[np.argsort(data.ravel())], np.arange(n_samples)
      )
  
imports: import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  from sklearn.ensemble._hist_gradient_boosting.binning import _BinMapper, _find_binning_thresholds, _map_to_bins
  from sklearn.ensemble._hist_gradient_boosting.common import ALMOST_INF, X_BINNED_DTYPE, X_DTYPE
  from sklearn.utils._openmp_helpers import _openmp_effective_n_threads
label_desc: Use image node_id 9 for calling a global function with example usage: test_bin_mapper_small_random_data(n_samples, max_bins) without return types