code: def test_train_step_with_tuning_output_yaml_correct(
      tmp_recipe_root_path: Path,
      tmp_recipe_exec_path: Path,
      with_hardcoded_params,
      expected_num_tuned,
      expected_num_hardcoded,
      num_sections,
  ):
      train_step_output_dir = setup_train_dataset(tmp_recipe_exec_path)
      train_step = setup_train_step_with_tuning(
          tmp_recipe_root_path,
          use_tuning=True,
          with_hardcoded_params=with_hardcoded_params,
      )
      with mock.patch("steps.train.estimator_fn", estimator_fn):
          train_step.run(str(train_step_output_dir))
      assert (train_step_output_dir / "best_parameters.yaml").exists()
  
      with open(
          os.path.join(train_step_output_dir, "best_parameters.yaml")
      ) as f:
          lines = f.readlines()
          assert lines[0] == "# tuned hyperparameters \n"
          if with_hardcoded_params:
              assert (
                  lines[expected_num_tuned + 2]
                  == "# hardcoded parameters \n"
              )
              assert (
                  lines[expected_num_tuned + expected_num_hardcoded + 4]
                  == "# default parameters \n"
              )
          else:
              assert (
                  lines[expected_num_tuned + 2]
                  == "# default parameters \n"
              )
          assert len(lines) == 19 + num_sections * 2
  
imports: import importlib
  import math
  import os
  import random
  import sys
  from pathlib import Path
  from typing import Optional
  from unittest import mock
  from unittest.mock import MagicMock, Mock
  import cloudpickle
  import pandas
  import pytest
  import sklearn.compose
  import mlflow
  from mlflow.environment_variables import MLFLOW_RECIPES_EXECUTION_TARGET_STEP_NAME
  from mlflow.recipes.steps.train import TrainStep
  from mlflow.recipes.utils import _RECIPE_CONFIG_FILE_NAME
  from mlflow.recipes.utils.execution import get_step_output_path
  from mlflow.tracking import MlflowClient
  from mlflow.utils.file_utils import read_yaml
  from mlflow.utils.mlflow_tags import MLFLOW_RECIPE_PROFILE_NAME, MLFLOW_RECIPE_STEP_NAME, MLFLOW_RECIPE_TEMPLATE_NAME, MLFLOW_SOURCE_TYPE
label_desc: Use image node_id 18 for calling a global function with example usage: test_train_step_with_tuning_output_yaml_correct(tmp_recipe_root_path, tmp_recipe_exec_path, with_hardcoded_params, expected_num_tuned, expected_num_hardcoded, num_sections) without return types