code: def test_balanced_random_forest_oob(imbalanced_dataset):
      X, y = imbalanced_dataset
      X_train, X_test, y_train, y_test = train_test_split(
          X, y, random_state=42, stratify=y
      )
      est = BalancedRandomForestClassifier(
          oob_score=True,
          random_state=0,
          n_estimators=1000,
          min_samples_leaf=2,
          sampling_strategy="all",
          replacement=True,
          bootstrap=True,
      )
  
      est.fit(X_train, y_train)
      test_score = est.score(X_test, y_test)
  
      assert abs(test_score - est.oob_score_) < 0.1
  
      # Check warning if not enough estimators
      est = BalancedRandomForestClassifier(
          oob_score=True,
          random_state=0,
          n_estimators=1,
          bootstrap=True,
          sampling_strategy="all",
          replacement=True,
      )
      with pytest.warns(UserWarning) and np.errstate(
          divide="ignore", invalid="ignore"
      ):
          est.fit(X, y)
  
imports: import numpy
  import pytest
  import sklearn
  from sklearn.datasets import load_iris, make_classification
  from sklearn.model_selection import GridSearchCV, train_test_split
  from sklearn.utils._testing import assert_allclose, assert_array_equal
  from sklearn.utils.fixes import parse_version
  from imblearn.ensemble import BalancedRandomForestClassifier
label_desc: Use image node_id 6 for calling a global function with example usage: test_balanced_random_forest_oob(imbalanced_dataset) without return types