code: def test_predict_only_one_or_minus_one(
      estimator, build_dataset, with_preprocessor
  ):
      """Test that all predicted values are either +1 or -1"""
      input_data, _, preprocessor, _ = build_dataset(with_preprocessor)
      estimator = clone(estimator)
      estimator.set_params(preprocessor=preprocessor)
      set_random_state(estimator)
      triplets_train, triplets_test = train_test_split(input_data)
      estimator.fit(triplets_train)
      predictions = estimator.predict(triplets_test)
  
      not_valid = [e for e in predictions if e not in [-1, 1]]
      assert len(not_valid) == 0
  
file_path: metric-learn/test/test_triplets_classifiers.py
imports: import pytest
  from sklearn.exceptions import NotFittedError
  from sklearn.model_selection import train_test_split
  from metric_learn import SCML
  from test.test_utils import triplets_learners, ids_triplets_learners, build_triplets
  from metric_learn.sklearn_shims import set_random_state
  from sklearn import clone
  import numpy
  from numpy.testing import assert_array_equal
label_desc: Use image node_id 1 for calling a global function with example usage: test_predict_only_one_or_minus_one(estimator, build_dataset, with_preprocessor) without return types