code: def test_adding_step_key(tmpdir):
      class CustomTensorBoardLogger(TensorBoardLogger):
          def __init__(self, *args, **kwargs) -> None:
              super().__init__(*args, **kwargs)
              self.logged_step = 0
  
          def log_metrics(self, metrics, step):
              if "val_acc" in metrics:
                  assert step == self.logged_step
  
              super().log_metrics(metrics, step)
  
      class CustomModel(BoringModel):
          def on_train_epoch_end(self):
              self.logger.logged_step += 1
              self.log_dict(
                  {
                      "step": self.logger.logged_step,
                      "train_acc": self.logger.logged_step / 10,
                  }
              )
  
          def on_validation_epoch_end(self):
              self.logger.logged_step += 1
              self.log_dict(
                  {
                      "step": self.logger.logged_step,
                      "val_acc": self.logger.logged_step / 10,
                  }
              )
  
      model = CustomModel()
      trainer = Trainer(
          max_epochs=3,
          logger=CustomTensorBoardLogger(save_dir=tmpdir),
          default_root_dir=tmpdir,
          limit_train_batches=0.1,
          limit_val_batches=0.1,
          num_sanity_val_steps=0,
      )
      trainer.fit(model)
  
imports: import pickle
  from argparse import Namespace
  from copy import deepcopy
  from typing import Any, Dict, Optional
  from unittest.mock import patch
  import numpy
  import pytest
  import torch
  from lightning.fabric.utilities.logger import _convert_params, _sanitize_params
  from lightning.pytorch import Trainer
  from lightning.pytorch.demos.boring_classes import BoringDataModule, BoringModel
  from lightning.pytorch.loggers import Logger, TensorBoardLogger
  from lightning.pytorch.loggers.logger import DummyExperiment, DummyLogger
  from lightning.pytorch.loggers.utilities import _scan_checkpoints
  from lightning.pytorch.utilities.rank_zero import rank_zero_only
label_desc: Use image node_id 4 for calling a global function with example usage: test_adding_step_key(tmpdir) without return types