code: def test_invalid_optimizer_dict_raises(tmpdir):
      """Test exception when lr_scheduler dict has no scheduler."""
  
      class DummyModel(BoringModel):
          def configure_optimizers(self):
              return [
                  {"optimizer": optim.Adam(self.parameters())},
                  optim.Adam(self.parameters()),
              ]
  
      model = DummyModel()
      trainer = Trainer(default_root_dir=tmpdir, fast_dev_run=True)
      with pytest.raises(
          MisconfigurationException,
          match="Unknown configuration for model optimizers",
      ):
          trainer.fit(model)
  
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 20 for calling a global function with example usage: test_invalid_optimizer_dict_raises(tmpdir) and returns: list