code: def test_history_backward_compatibility():
      from fedot.core.optimisers.objective import (
          init_backward_serialize_compat,
      )
  
      init_backward_serialize_compat()
  
      test_history_path = Path(
          fedot_project_root(),
          "test",
          "data",
          "fast_train_classification_history.json",
      )
      history = OptHistory.load(test_history_path)
      # Pre-computing properties
      all_historical_fitness = history.all_historical_fitness
      historical_fitness = history.historical_fitness
      # Assert presence of necessary fields after deserialization of old history
      assert hasattr(history, "objective")
      # Assert that properties are not empty
      assert all_historical_fitness
      assert historical_fitness
      # Assert that all fitness properties are valid.
      assert len(history.individuals) == len(historical_fitness)
      assert np.all(
          len(generation) == len(gen_fitness)
          for generation, gen_fitness in zip(
              history.individuals, historical_fitness
          )
      )
      assert np.all(
          np.equal(
              [
                  ind.fitness.value
                  for ind in chain(*history.individuals)
              ],
              all_historical_fitness,
          )
      )
      # Assert that fitness, graph, parent_individuals, and objective are valid
      assert all(
          isinstance(ind.fitness, SingleObjFitness)
          for ind in chain(*history.individuals)
      )
      assert all(ind.graph.nodes for ind in chain(*history.individuals))
      assert all(
          isinstance(parent_ind, Individual)
          for ind in chain(*history.individuals)
          for parent_op in ind.operators_from_prev_generation
          for parent_ind in parent_op.parent_individuals
      )
      _test_individuals_in_history(history)
  
imports: from itertools import chain
  from pathlib import Path
  import numpy
  import pytest
  from golem.core.dag.graph import Graph
  from golem.core.optimisers.fitness import SingleObjFitness
  from golem.core.optimisers.genetic.evaluation import MultiprocessingDispatcher
  from golem.core.optimisers.opt_history_objects.individual import Individual
  from golem.core.optimisers.opt_history_objects.opt_history import OptHistory
  from fedot import Fedot
  from fedot.core.data.data import InputData
  from fedot.core.operations.model import Model
  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_graph_generation_params import get_pipeline_generation_params
  from fedot.core.repository.metrics_repository import ClassificationMetricsEnum, MetricIDType, RegressionMetricsEnum
  from fedot.core.repository.tasks import TaskTypesEnum
  from fedot.core.utils import fedot_project_root
  from test.unit.tasks.test_forecasting import get_ts_data
  from test.unit.validation.test_table_cv import get_classification_data
label_desc: Use image node_id 7 for calling a global function with example usage: test_history_backward_compatibility() without return types