code: def test_optimizer_config_dict_with_extra_keys_warns(tmpdir):
      """Test exception when optimizer configuration dict has extra keys."""
      model = BoringModel()
      optimizer = optim.Adam(model.parameters())
      optim_conf = {
          "optimizer": optimizer,
          "lr_scheduler": {
              "scheduler": optim.lr_scheduler.StepLR(optimizer, 1)
          },
          "foo": 1,
          "bar": 2,
      }
      with pytest.warns(
          RuntimeWarning,
          match=r"Found unsupported keys in the optimizer configuration: \{.+\}",
      ):
          _configure_optimizers(optim_conf)
  
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 14 for calling a global function with example usage: test_optimizer_config_dict_with_extra_keys_warns(tmpdir) without return types