def test_unknown_configure_optimizers_raises(tmp_path):
    """Test exception with an unsupported configure_optimizers return."""
    model = BoringModel()
    model.configure_optimizers = lambda: 1
    trainer = Trainer(default_root_dir=tmp_path, fast_dev_run=True)
    with pytest.raises(MisconfigurationException, match="Unknown configuration for model optimizers"):
        trainer.fit(model)
Test exception with an unsupported configure_optimizers return.
tests/tests_pytorch/trainer/optimization/test_optimizers.py