def METHOD_NAME(caplog):
    trainer = Mock(spec=Trainer)
    fit_loop = _FitLoop(trainer, max_epochs=1)
    trainer.should_stop = False
    fit_loop.max_batches = 5
    assert not fit_loop.done
    assert not caplog.messages
    fit_loop.max_batches = 0
    assert fit_loop.done
    assert "No training batches" in caplog.text
    caplog.clear()
    fit_loop.max_batches = 5
    epoch_loop = Mock()
    epoch_loop.global_step = 10
    fit_loop.epoch_loop = epoch_loop
    epoch_loop.max_steps = 10
    assert fit_loop.done
    assert "max_steps=10` reached" in caplog.text
    caplog.clear()
    epoch_loop.max_steps = 20
    fit_loop.epoch_progress.current.processed = 3
    fit_loop.max_epochs = 3
    trainer.should_stop = True
    assert fit_loop.done
    assert "max_epochs=3` reached" in caplog.text
    caplog.clear()
    fit_loop.max_epochs = 5
    fit_loop.epoch_loop.min_steps = 0
    with caplog.at_level(level=logging.DEBUG, logger="lightning.pytorch.utilities.rank_zero"):
        assert fit_loop.done
    assert "should_stop` was set" in caplog.text
    fit_loop.epoch_loop.min_steps = 100
    assert not fit_loop.done