code: def test_n_bins_non_missing(n_bins, diff):
      # Check that n_bins_non_missing is n_unique_values when
      # there are not a lot of unique values, else n_bins - 1.
  
      n_unique_values = n_bins + diff
      X = list(range(n_unique_values)) * 2
      X = np.array(X).reshape(-1, 1)
      mapper = _BinMapper(n_bins=n_bins).fit(X)
      assert np.all(
          mapper.n_bins_non_missing_ == min(n_bins - 1, n_unique_values)
      )
  
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 14 for calling a global function with example usage: test_n_bins_non_missing(n_bins, diff) without return types