code: def test_lr_scheduler_strict(step_mock, tmpdir, complete_epoch):
      """Test "strict" support in lr_scheduler dict."""
      model = BoringModel()
      optimizer = optim.Adam(model.parameters())
      scheduler = optim.lr_scheduler.ReduceLROnPlateau(optimizer)
      max_epochs = 1 if complete_epoch else None
      max_steps = -1 if complete_epoch else 1
      trainer = Trainer(
          default_root_dir=tmpdir,
          max_epochs=max_epochs,
          max_steps=max_steps,
      )
  
      model.configure_optimizers = lambda: {
          "optimizer": optimizer,
          "lr_scheduler": {
              "scheduler": scheduler,
              "monitor": "giraffe",
              "strict": True,
          },
      }
  
      if complete_epoch:
          with pytest.raises(
              MisconfigurationException,
              match=r"ReduceLROnPlateau conditioned on metric .* which is not available\. Available metrics are:",
          ):
              trainer.fit(model)
      else:
          trainer.fit(model)
  
      step_mock.assert_not_called()
  
      model.configure_optimizers = lambda: {
          "optimizer": optimizer,
          "lr_scheduler": {
              "scheduler": scheduler,
              "monitor": "giraffe",
              "strict": False,
          },
      }
  
      if complete_epoch:
          trainer = Trainer(
              default_root_dir=tmpdir,
              max_epochs=max_epochs,
              max_steps=max_steps,
          )
          with pytest.warns(
              RuntimeWarning,
              match=r"ReduceLROnPlateau conditioned on metric .* which is not available but strict",
          ):
              trainer.fit(model)
  
      step_mock.assert_not_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 12 for calling a global function with example usage: test_lr_scheduler_strict(step_mock, tmpdir, complete_epoch) without return types