code: def test_tune_checkpoint(ray_start_4_cpus):
      def train_func():
          for i in range(9):
              train.report(dict(test=i))
          with create_dict_checkpoint(
              dict(hello="world")
          ) as checkpoint:
              train.report(dict(test=i + 1), checkpoint=checkpoint)
  
      trainer = DataParallelTrainer(
          train_func,
          backend_config=TestConfig(),
          scaling_config=ScalingConfig(num_workers=1),
      )
      tuner = Tuner(
          trainer,
          param_space={"train_loop_config": {"max_iter": 5}},
      )
  
      result_grid = tuner.fit()
      assert len(result_grid) == 1
      result = result_grid[0]
      assert result.checkpoint
      assert load_dict_checkpoint(result.checkpoint)["hello"] == "world"
  
imports: import logging
  import pytest
  import ray
  from ray import train, tune
  from ray.air.constants import TRAINING_ITERATION
  from ray.train import FailureConfig, RunConfig, ScalingConfig
  from ray.train._internal.worker_group import WorkerGroup
  from ray.train.backend import Backend, BackendConfig
  from ray.train.data_parallel_trainer import DataParallelTrainer
  from ray.train.examples.pytorch.torch_fashion_mnist_example import train_func_per_worker
  from ray.train.examples.tf.tensorflow_mnist_example import train_func
  from ray.train.tensorflow.tensorflow_trainer import TensorflowTrainer
  from ray.train.tests.util import create_dict_checkpoint, load_dict_checkpoint
  from ray.train.torch.torch_trainer import TorchTrainer
  from ray.tune.tune_config import TuneConfig
  from ray.tune.tuner import Tuner
label_desc: Use image node_id 8 for calling a global function with example usage: test_tune_checkpoint(ray_start_4_cpus) without return types