code: def test_predict_before_fit_error(
      X_transform,
      sensitive_features_transform,
      predict_method_name,
      constraints,
  ):
      X = X_transform(sensitive_features_ex1)
      sensitive_features = sensitive_features_transform(
          sensitive_features_ex1
      )
      adjusted_predictor = ThresholdOptimizer(
          estimator=ExamplePredictor(scores_ex),
          constraints=constraints,
          prefit=False,
          predict_method="predict",
      )
  
      with pytest.raises(
          ValueError, match="instance is not fitted yet"
      ):
          getattr(adjusted_predictor, predict_method_name)(
              X, sensitive_features=sensitive_features
          )
  
imports: from copy import deepcopy
  from test.unit.input_convertors import _map_into_single_column
  import numpy
  import pandas
  import pytest
  from sklearn.base import BaseEstimator, ClassifierMixin
  from sklearn.datasets import make_classification
  from fairlearn.postprocessing import ThresholdOptimizer
  from fairlearn.postprocessing._threshold_optimizer import BASE_ESTIMATOR_NONE_ERROR_MESSAGE, NOT_SUPPORTED_CONSTRAINTS_ERROR_MESSAGE
  from fairlearn.postprocessing._tradeoff_curve_utilities import DEGENERATE_LABELS_ERROR_MESSAGE
  from fairlearn.utils._input_validation import _LABELS_NOT_0_1_ERROR_MESSAGE, _MESSAGE_SENSITIVE_FEATURES_NONE, _MESSAGE_Y_NONE
  from .conftest import ExamplePredictor, X_ex, _get_predictions_by_sensitive_feature, candidate_A_transforms, candidate_X_transforms, candidate_Y_transforms, degenerate_labels_ex, is_invalid_transformation, labels_ex, scores_ex, sensitive_feature_names_ex1, sensitive_features_ex1
label_desc: Use image node_id 1 for calling a global function with example usage: test_predict_before_fit_error(X_transform, sensitive_features_transform, predict_method_name, constraints) without return types