code: def test_feature_num_bin_with_max_bin_by_feature():
      X = np.random.rand(100, 3)
      max_bin_by_feature = np.random.randint(3, 30, size=X.shape[1])
      ds = lgb.Dataset(
          X, params={"max_bin_by_feature": max_bin_by_feature}
      ).construct()
      actual_num_bins = [
          ds.feature_num_bin(i) for i in range(X.shape[1])
      ]
      np.testing.assert_equal(actual_num_bins, max_bin_by_feature)
  
imports: import filecmp
  import numbers
  import re
  from copy import deepcopy
  from os import getenv
  from pathlib import Path
  import numpy
  import pytest
  from scipy import sparse
  from sklearn.datasets import dump_svmlight_file, load_svmlight_file
  from sklearn.model_selection import train_test_split
  import lightgbm
  from lightgbm.compat import PANDAS_INSTALLED, pd_DataFrame, pd_Series
  from .utils import dummy_obj, load_breast_cancer, mse_obj, np_assert_array_equal
label_desc: Use image node_id 32 for calling a global function with example usage: test_feature_num_bin_with_max_bin_by_feature() without return types