code: def test_checkpointing_config():
      with pytest.raises(ValueError):
          CheckpointConfig(
              checkpoint_score_attribute="metric",
              checkpoint_score_order="invalid",
          )
  
      checkpointing = CheckpointConfig()
      assert checkpointing._tune_legacy_checkpoint_score_attr is None
  
      checkpointing = CheckpointConfig(
          checkpoint_score_attribute="metric"
      )
      assert (
          checkpointing._tune_legacy_checkpoint_score_attr == "metric"
      )
  
      checkpointing = CheckpointConfig(
          checkpoint_score_attribute="metric",
          checkpoint_score_order="max",
      )
      assert (
          checkpointing._tune_legacy_checkpoint_score_attr == "metric"
      )
  
      checkpointing = CheckpointConfig(
          checkpoint_score_attribute="metric",
          checkpoint_score_order="min",
      )
      assert (
          checkpointing._tune_legacy_checkpoint_score_attr
          == "min-metric"
      )
  
imports: import pytest
  import ray
  from ray.train import Checkpoint, CheckpointConfig, ScalingConfig
  from ray.air._internal.config import ensure_only_allowed_dataclass_keys_updated
  from ray.data.preprocessor import Preprocessor
  from ray.train.trainer import BaseTrainer
label_desc: Use image node_id 2 for calling a global function with example usage: test_checkpointing_config() without return types