def test_multiple_early_stopping_callbacks(
    tmp_path,
    callbacks: list[EarlyStopping],
    expected_stop_epoch: int,
    check_on_train_epoch_end: bool,
    strategy: str,
    devices: int,
    dist_diverge_epoch: Optional[int],
):
    """Ensure when using multiple early stopping callbacks we stop if any signals we should stop."""

    model = EarlyStoppingModel(expected_stop_epoch, check_on_train_epoch_end, dist_diverge_epoch=dist_diverge_epoch)

    trainer = Trainer(
        default_root_dir=tmp_path,
        callbacks=callbacks,
        limit_train_batches=0.1,
        limit_val_batches=0.1,
        max_epochs=20,
        strategy=strategy,
        accelerator="cpu",
        devices=devices,
    )
    trainer.fit(model)
Ensure when using multiple early stopping callbacks we stop if any signals we should stop.
tests/tests_pytorch/callbacks/test_early_stopping.py