code: def test_accuracy_toy_example(estimator, build_dataset):
      """Test that the default scoring for triplets (accuracy) works on some
      toy example"""
      triplets, _, _, X = build_dataset(with_preprocessor=False)
      estimator = clone(estimator)
      set_random_state(estimator)
      estimator.fit(triplets)
      # We take the two first points and we build 4 regularly spaced points on the
      # line they define, so that it's easy to build triplets of different
      # similarities.
      X_test = X[0] + np.arange(4)[:, np.newaxis] * (X[0] - X[1]) / 4
  
      triplets_test = np.array(
          [
              [X_test[0], X_test[2], X_test[1]],
              [X_test[1], X_test[3], X_test[0]],
              [X_test[1], X_test[2], X_test[3]],
              [X_test[3], X_test[0], X_test[2]],
          ]
      )
      # we force the transformation to be identity so that we control what it does
      estimator.components_ = np.eye(X.shape[1])
      assert estimator.score(triplets_test) == 0.25
  
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 4 for calling a global function with example usage: test_accuracy_toy_example(estimator, build_dataset) without return types