def test_lr_scheduler_with_no_actual_scheduler_raises(tmp_path):
    """Test exception when lr_scheduler dict has no scheduler."""
    model = BoringModel()
    model.configure_optimizers = lambda: {"optimizer": optim.Adam(model.parameters()), "lr_scheduler": {}}
    trainer = Trainer(default_root_dir=tmp_path, fast_dev_run=True)
    with pytest.raises(MisconfigurationException, match='The lr scheduler dict must have the key "scheduler"'):
        trainer.fit(model)
Test exception when lr_scheduler dict has no scheduler.
tests/tests_pytorch/trainer/optimization/test_optimizers.py