code: def test_lr_monitor_no_lr_scheduler_single_lr(tmpdir):
      """Test that learning rates are extracted and logged for no lr scheduler."""
  
      class CustomBoringModel(BoringModel):
          def configure_optimizers(self):
              return optim.SGD(self.parameters(), lr=0.1)
  
      model = CustomBoringModel()
  
      lr_monitor = LearningRateMonitor()
      trainer = Trainer(
          default_root_dir=tmpdir,
          max_epochs=2,
          limit_val_batches=0.1,
          limit_train_batches=0.5,
          callbacks=[lr_monitor],
          logger=CSVLogger(tmpdir),
      )
  
      trainer.fit(model)
  
      assert lr_monitor.lrs, "No learning rates logged"
      assert len(lr_monitor.lrs) == len(trainer.optimizers)
      assert list(lr_monitor.lrs) == ["lr-SGD"]
  
imports: import pytest
  import torch
  from lightning.pytorch import Trainer
  from lightning.pytorch.callbacks import EarlyStopping, LearningRateMonitor
  from lightning.pytorch.callbacks.callback import Callback
  from lightning.pytorch.callbacks.finetuning import BackboneFinetuning
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.loggers import CSVLogger
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from torch import optim
  from tests_pytorch.helpers.datamodules import ClassifDataModule
  from tests_pytorch.helpers.runif import RunIf
  from tests_pytorch.helpers.simple_models import ClassificationModel
label_desc: Use image node_id 4 for calling a global function with example usage: test_lr_monitor_no_lr_scheduler_single_lr(tmpdir) and returns: optim