code: def test_extraction_from_grid_search_cv():
      """Test the extraction from an optimizer."""
      from sklearn.model_selection import GridSearchCV
  
      params = {
          "kernel": ("linear", "rbf"),
          "C": [1, 10, 100],
          "gamma": [0.001, 0.0001],
      }
      search = GridSearchCV(SVC(), params, cv=2)
  
      # Test unfitted optimizer:
      with pytest.raises(ValueError):
          est = Estimator(search)
          assert isinstance(est.estimator, SVC)
  
      # Test fitted optimizer:
      search.fit(
          X=[[1, 1], [2, 2], [3, 3], [1, 1], [2, 2], [3, 3]],
          y=[1, 2, 3, 1, 2, 3],
      )
      est = Estimator(search)
      assert isinstance(est.estimator, SVC)
  
imports: import os
  import random
  import shutil
  import warnings
  from os import environ
  from pathlib import Path
  from sys import version_info
  from typing import Callable, Tuple
  import numpy
  import pytest
  from joblib import dump
  from sklearn import preprocessing
  from sklearn.base import BaseEstimator
  from sklearn.datasets import load_iris
  from sklearn.ensemble.forest import ExtraTreesClassifier, RandomForestClassifier
  from sklearn.ensemble.weight_boosting import AdaBoostClassifier
  from sklearn.linear_model import SGDClassifier
  from sklearn.naive_bayes import BernoulliNB, GaussianNB
  from sklearn.neighbors.classification import KNeighborsClassifier
  from sklearn.svm import SVC, LinearSVC, NuSVC
  from sklearn.tree.tree import DecisionTreeClassifier
  from sklearn_porter import exceptions
  from sklearn_porter.cli.__main__ import parse_args
  from sklearn_porter.Estimator import Estimator, can, show
  from sklearn_porter.cli.command.port import main
  from sklearn_porter.cli.command.save import main
  from sklearn_porter.cli.command.show import main
  from tests.commons import SKLEARN_VERSION, CANDIDATES, CLASSIFIERS, DATASETS, Candidate, Dataset, ROOT_DIR, RESOURCES_DIR
  from tests.utils import dataset_generate_x, dataset_uniform_x, fs_mkdir
label_desc: Use image node_id 22 for calling a global function with example usage: test_extraction_from_grid_search_cv() without return types