code: def test_validate_functions():
      """Check that valid functions are accepted & invalid ones raise error"""
  
      for Symbolic in (SymbolicRegressor, SymbolicTransformer):
          # These should be fine
          est = Symbolic(
              population_size=100,
              generations=2,
              random_state=0,
              function_set=(add2, sub2, mul2, div2),
          )
          est.fit(diabetes.data, diabetes.target)
          est = Symbolic(
              population_size=100,
              generations=2,
              random_state=0,
              function_set=("add", "sub", "mul", div2),
          )
          est.fit(diabetes.data, diabetes.target)
  
          # These should fail
          est = Symbolic(
              generations=2,
              random_state=0,
              function_set=("ni", "sub", "mul", div2),
          )
          assert_raises(
              ValueError, est.fit, diabetes.data, diabetes.target
          )
          est = Symbolic(
              generations=2,
              random_state=0,
              function_set=(7, "sub", "mul", div2),
          )
          assert_raises(
              ValueError, est.fit, diabetes.data, diabetes.target
          )
          est = Symbolic(generations=2, random_state=0, function_set=())
          assert_raises(
              ValueError, est.fit, diabetes.data, diabetes.target
          )
  
      # Now for the classifier... These should be fine
      est = SymbolicClassifier(
          population_size=100,
          generations=2,
          random_state=0,
          function_set=(add2, sub2, mul2, div2),
      )
      est.fit(cancer.data, cancer.target)
      est = SymbolicClassifier(
          population_size=100,
          generations=2,
          random_state=0,
          function_set=("add", "sub", "mul", div2),
      )
      est.fit(cancer.data, cancer.target)
  
      # These should fail
      est = SymbolicClassifier(
          generations=2,
          random_state=0,
          function_set=("ni", "sub", "mul", div2),
      )
      assert_raises(ValueError, est.fit, cancer.data, cancer.target)
      est = SymbolicClassifier(
          generations=2,
          random_state=0,
          function_set=(7, "sub", "mul", div2),
      )
      assert_raises(ValueError, est.fit, cancer.data, cancer.target)
      est = SymbolicClassifier(
          generations=2, random_state=0, function_set=()
      )
      assert_raises(ValueError, est.fit, cancer.data, cancer.target)
  
imports: import pickle
  import pytest
  import sys
  from io import StringIO
  import numpy
  from scipy.stats import pearsonr, spearmanr
  from sklearn.datasets import load_diabetes, load_breast_cancer
  from sklearn.metrics import mean_absolute_error
  from sklearn.model_selection import GridSearchCV
  from sklearn.pipeline import make_pipeline
  from sklearn.preprocessing import StandardScaler
  from sklearn.tree import DecisionTreeRegressor
  from sklearn.utils._testing import assert_almost_equal
  from sklearn.utils._testing import assert_array_equal
  from sklearn.utils._testing import assert_array_almost_equal
  from sklearn.utils._testing import assert_raises
  from sklearn.utils.validation import check_random_state
  from gplearn.genetic import SymbolicClassifier, SymbolicRegressor
  from gplearn.genetic import SymbolicTransformer
  from gplearn.fitness import weighted_pearson, weighted_spearman
  from gplearn._program import _Program
  from gplearn.fitness import _fitness_map
  from gplearn.functions import add2, sub2, mul2, div2, sqrt1, log1, abs1, max2, min2
  from gplearn.functions import _Function
label_desc: Use image node_id 30 for calling a global function with example usage: test_validate_functions() without return types