code: def test_optional_step_matching(env_boston, feature_engineer):
      """Tests that a Space containing `optional` `Categorical` Feature Engineering steps matches with
      the expected saved Experiments. This regression test is focused on issues that arise when
      `EngineerStep`s other than the last one in the `FeatureEngineer` are `optional`. The simplified
      version of this test below, :func:`test_limited_optional_step_matching`, demonstrates that
      result matching works properly when only the final `EngineerStep` is `optional`
      """
      opt_0 = DummyOptPro(iterations=20, random_state=32)
      opt_0.forge_experiment(
          XGBRegressor, feature_engineer=feature_engineer
      )
      opt_0.go()
  
      opt_1 = ExtraTreesOptPro(iterations=20, random_state=32)
      opt_1.forge_experiment(
          XGBRegressor, feature_engineer=feature_engineer
      )
      opt_1.get_ready()
  
      # Assert `opt_1` matched with all Experiments executed by `opt_0`
      assert (
          len(opt_1.similar_experiments) == opt_0.successful_iterations
      )
  
imports: from hyperparameter_hunter import Environment, FeatureEngineer, EngineerStep, __version__
  from hyperparameter_hunter import CVExperiment, Real, Integer, Categorical
  from hyperparameter_hunter import BayesianOptPro, DummyOptPro, ExtraTreesOptPro
  from hyperparameter_hunter.utils.learning_utils import get_boston_data
  from hyperparameter_hunter.utils.version_utils import HHVersion
  from os import makedirs
  import pytest
  from shutil import rmtree
  from xgboost import XGBRegressor
label_desc: Use image node_id 14 for calling a global function with example usage: test_optional_step_matching(env_boston, feature_engineer) without return types