code: def test_no_matplotlib(constraints):
      n_samples = 50
      n_features = 50
      n_sensitive_feature_values = 2
      n_classes = 2
  
      threshold_optimizer = ThresholdOptimizer(
          estimator=FakePredictor(),
          constraints=constraints,
          predict_method="predict",
      )
      threshold_optimizer.fit(
          X=np.random.random((n_samples, n_features)),
          y=np.random.randint(n_classes, size=n_samples),
          sensitive_features=np.random.randint(
              n_sensitive_feature_values, size=n_samples
          ),
      )
  
      with pytest.raises(RuntimeError) as exc:
          plot_threshold_optimizer(threshold_optimizer)
          assert str(exc.value) == _MATPLOTLIB_IMPORT_ERROR_MESSAGE
  
file_path: fairlearn/test/install/test_no_matplotlib.py
imports: import numpy
  import pytest
  from sklearn.base import BaseEstimator, ClassifierMixin
  from fairlearn.postprocessing import ThresholdOptimizer, plot_threshold_optimizer
  from fairlearn.postprocessing._constants import _MATPLOTLIB_IMPORT_ERROR_MESSAGE
  from fairlearn.metrics import plot_model_comparison
  from fairlearn.postprocessing._threshold_optimizer import SIMPLE_CONSTRAINTS
label_desc: Use image node_id 1 for calling a global function with example usage: test_no_matplotlib(constraints) without return types