code: def test_plateau_scheduler_lr_step_interval_updated_after_saving(
      tmpdir, save_on_train_epoch_end
  ):
      batches = 4
      trainer = Trainer(
          default_root_dir=tmpdir,
          enable_progress_bar=False,
          logger=False,
          max_epochs=1,
          limit_train_batches=batches,
          limit_val_batches=1,
          callbacks=[
              ModelCheckpoint(
                  dirpath=tmpdir,
                  save_on_train_epoch_end=save_on_train_epoch_end,
              )
          ],
      )
  
      class Model(BoringModel):
          def training_step(self, batch, batch_idx):
              self.log("foo", batch_idx)
              return super().training_step(batch, batch_idx)
  
          def configure_optimizers(self):
              optimizer = torch.optim.Adam(self.parameters())
  
              lr_scheduler1 = (
                  torch.optim.lr_scheduler.ReduceLROnPlateau(optimizer)
              )
              lr_scheduler_config_1 = {
                  "scheduler": lr_scheduler1,
                  "interval": "step",
                  "monitor": "foo",
              }
  
              lr_scheduler2 = torch.optim.lr_scheduler.StepLR(
                  optimizer, step_size=1
              )
              lr_scheduler_config_2 = {
                  "scheduler": lr_scheduler2,
                  "interval": "step",
              }
              return [optimizer], [
                  lr_scheduler_config_1,
                  lr_scheduler_config_2,
              ]
  
          def on_save_checkpoint(self, checkpoint):
              lr_scheduler_config_1 = checkpoint["lr_schedulers"][0]
              last_epoch = lr_scheduler_config_1["last_epoch"]
              assert last_epoch == batches - (
                  not save_on_train_epoch_end
              )  # last epoch starts at 0
  
              lr_scheduler_config_2 = checkpoint["lr_schedulers"][1]
              assert (
                  lr_scheduler_config_2["_step_count"] - 1 == batches
              )  # step count starts at 1
  
              self.on_save_checkpoint_called = True
  
      model = Model()
      trainer.fit(model)
      assert model.on_save_checkpoint_called
  
imports: from unittest import mock
  from unittest.mock import call
  import pytest
  import torch
  from lightning.pytorch import Trainer
  from lightning.pytorch.callbacks import ModelCheckpoint
  from lightning.pytorch.core.optimizer import _configure_optimizers, _configure_schedulers_automatic_opt, _init_optimizers_and_lr_schedulers
  from lightning.pytorch.demos.boring_classes import BoringDataModule, BoringModel
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.types import LRSchedulerConfig
  from torch import optim
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 24 for calling a global function with example usage: test_plateau_scheduler_lr_step_interval_updated_after_saving(tmpdir, save_on_train_epoch_end) and returns: super, list,  list