def test_configure_optimizer_from_dict(tmp_path):
    """Tests if `configure_optimizer` method could return a dictionary with `optimizer` field only."""

    class TestModel(BoringModel):
        def configure_optimizers(self):
            return {"optimizer": optim.SGD(params=self.parameters(), lr=1e-03)}

    model = TestModel()
    trainer = Trainer(default_root_dir=tmp_path, fast_dev_run=True)
    trainer.fit(model)
Tests if `configure_optimizer` method could return a dictionary with `optimizer` field only.
tests/tests_pytorch/trainer/optimization/test_optimizers.py