code: def test_callbacks() -> None:
      callbacks = []
  
      for _ in range(2):
          callback = MagicMock()
          callback.__call__ = MagicMock(return_value=None)  # type: ignore
          callbacks.append(callback)
  
      n_trials = 5
      X, y = make_blobs(n_samples=10)
      est = SGDClassifier(max_iter=5, tol=1e-03)
      param_dist = {
          "alpha": distributions.FloatDistribution(
              1e-04, 1e03, log=True
          )
      }
      optuna_search = integration.OptunaSearchCV(
          est,
          param_dist,
          cv=3,
          enable_pruning=True,
          max_iter=5,
          n_trials=n_trials,
          error_score=np.nan,
          callbacks=callbacks,  # type: ignore
      )
  
      with warnings.catch_warnings():
          warnings.simplefilter("ignore", category=ConvergenceWarning)
          optuna_search.fit(X, y)
  
      for callback in callbacks:
          for trial in optuna_search.trials_:
              callback.assert_any_call(optuna_search.study_, trial)
          assert callback.call_count == n_trials
  
imports: from __future__ import annotations
  from unittest.mock import MagicMock
  from unittest.mock import patch
  import warnings
  import numpy
  import pytest
  import scipy
  from sklearn.datasets import make_blobs
  from sklearn.datasets import make_regression
  from sklearn.decomposition import PCA
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.exceptions import NotFittedError
  from sklearn.linear_model import LogisticRegression
  from sklearn.linear_model import SGDClassifier
  from sklearn.neighbors import KernelDensity
  from sklearn.tree import DecisionTreeRegressor
  from optuna import distributions
  from optuna import integration
  from optuna.samplers import BruteForceSampler
  from optuna.study import create_study
  from optuna.terminator.erroreval import _CROSS_VALIDATION_SCORES_KEY
label_desc: Use image node_id 20 for calling a global function with example usage: test_callbacks() without return types