code: def test_ovr_always_present():
      # Test that ovr works with classes that are always present or absent.
      # Note: tests is the case where _ConstantPredictor is utilised
      X = np.ones((10, 2))
      X[:5, :] = 0
  
      # Build an indicator matrix where two features are always on.
      # As list of lists, it would be: [[int(i >= 5), 2, 3] for i in range(10)]
      y = np.zeros((10, 3))
      y[5:, 0] = 1
      y[:, 1] = 1
      y[:, 2] = 1
  
      ovr = OneVsRestClassifier(LogisticRegression())
      msg = r"Label .+ is present in all training examples"
      with pytest.warns(UserWarning, match=msg):
          ovr.fit(X, y)
      y_pred = ovr.predict(X)
      assert_array_equal(np.array(y_pred), np.array(y))
      y_pred = ovr.decision_function(X)
      assert np.unique(y_pred[:, -2:]) == 1
      y_pred = ovr.predict_proba(X)
      assert_array_equal(y_pred[:, -1], np.ones(X.shape[0]))
  
      # y has a constantly absent label
      y = np.zeros((10, 2))
      y[5:, 0] = 1  # variable label
      ovr = OneVsRestClassifier(LogisticRegression())
  
      msg = r"Label not 1 is present in all training examples"
      with pytest.warns(UserWarning, match=msg):
          ovr.fit(X, y)
      y_pred = ovr.predict_proba(X)
      assert_array_equal(y_pred[:, -1], np.zeros(X.shape[0]))
  
imports: from re import escape
  import numpy
  import pytest
  import scipy.sparse
  from numpy.testing import assert_allclose
  from sklearn import datasets, svm
  from sklearn.datasets import load_breast_cancer
  from sklearn.exceptions import NotFittedError
  from sklearn.impute import SimpleImputer
  from sklearn.linear_model import ElasticNet, Lasso, LinearRegression, LogisticRegression, Perceptron, Ridge, SGDClassifier
  from sklearn.metrics import precision_score, recall_score
  from sklearn.model_selection import GridSearchCV, cross_val_score
  from sklearn.multiclass import OneVsOneClassifier, OneVsRestClassifier, OutputCodeClassifier
  from sklearn.naive_bayes import MultinomialNB
  from sklearn.neighbors import KNeighborsClassifier
  from sklearn.pipeline import Pipeline, make_pipeline
  from sklearn.svm import SVC, LinearSVC
  from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
  from sklearn.utils import check_array, shuffle
  from sklearn.utils._mocking import CheckingClassifier
  from sklearn.utils._testing import assert_almost_equal, assert_array_equal
  from sklearn.utils.fixes import COO_CONTAINERS, CSC_CONTAINERS, CSR_CONTAINERS, DOK_CONTAINERS, LIL_CONTAINERS
  from sklearn.utils.multiclass import check_classification_targets, type_of_target
label_desc: Use image node_id 8 for calling a global function with example usage: test_ovr_always_present() without return types