code: def test_gp_composer_with_adaptive_depth(data_fixture, request):
      data = request.getfixturevalue(data_fixture)
      dataset_to_compose = data
      available_secondary_model_types = ["rf", "knn", "logit", "dt"]
      available_primary_model_types = (
          available_secondary_model_types + ["scaling", "resample"]
      )
  
      quality_metric = lambda *args, **kwargs: 1.0  # noqa
      max_depth = 5
      num_gen = 3
      req = PipelineComposerRequirements(
          primary=available_primary_model_types,
          secondary=available_secondary_model_types,
          start_depth=2,
          max_depth=max_depth,
          num_of_generations=num_gen,
      )
      params = GPAlgorithmParameters(
          adaptive_depth=True,
          adaptive_depth_max_stagnation=num_gen - 1,
          genetic_scheme_type=GeneticSchemeTypesEnum.steady_state,
          pop_size=10,
      )
      composer = (
          ComposerBuilder(task=Task(TaskTypesEnum.classification))
          .with_requirements(req)
          .with_optimizer_params(params)
          .with_metrics(quality_metric)
          .build()
      )
  
      composer.compose_pipeline(data=dataset_to_compose)
  
      generations = composer.history.individuals
      current_depth = composer.optimizer.requirements.max_depth
      assert (
          req.start_depth <= current_depth < max_depth
      ), f"max depth couldn't have been reached in {num_gen}"
      assert all(
          ind.graph.depth < max_depth for ind in generations[-1]
      ), "last generation is too deep"
  
imports: import datetime
  from pathlib import Path
  import numpy
  import pandas
  import pytest
  from golem.core.optimisers.genetic.gp_params import GPAlgorithmParameters
  from golem.core.optimisers.genetic.operators.inheritance import GeneticSchemeTypesEnum
  from golem.core.optimisers.genetic.operators.selection import SelectionTypesEnum
  from golem.core.optimisers.random.random_search import RandomSearchOptimizer
  from sklearn.metrics import roc_auc_score
  from fedot import Fedot
  from fedot.core.caching.pipelines_cache import OperationsCache
  from fedot.core.composer.composer_builder import ComposerBuilder
  from fedot.core.composer.random_composer import RandomSearchComposer
  from fedot.core.data.data import InputData
  from fedot.core.optimisers.objective import PipelineObjectiveEvaluate
  from fedot.core.optimisers.objective.data_source_splitter import DataSourceSplitter
  from fedot.core.optimisers.objective.metrics_objective import MetricsObjective
  from fedot.core.pipelines.node import PipelineNode
  from fedot.core.pipelines.pipeline import Pipeline
  from fedot.core.pipelines.pipeline_composer_requirements import PipelineComposerRequirements
  from fedot.core.pipelines.pipeline_graph_generation_params import get_pipeline_generation_params
  from fedot.core.repository.dataset_types import DataTypesEnum
  from fedot.core.repository.operation_types_repository import OperationTypesRepository, get_operations_for_task
  from fedot.core.repository.metrics_repository import ClassificationMetricsEnum, ComplexityMetricsEnum
  from fedot.core.repository.tasks import Task, TaskTypesEnum
  from fedot.core.utils import fedot_project_root, set_random_seed
  from test.unit.pipelines.test_pipeline_comparison import pipeline_first, pipeline_second
label_desc: Use image node_id 9 for calling a global function with example usage: test_gp_composer_with_adaptive_depth(data_fixture, request) without return types