def test_min_max_steps_epochs(tmp_path, min_epochs, max_epochs, min_steps, max_steps):
    """Tests that max_steps can be used without max_epochs."""
    model = BoringModel()

    trainer = Trainer(
        default_root_dir=tmp_path,
        min_epochs=min_epochs,
        max_epochs=max_epochs,
        min_steps=min_steps,
        max_steps=max_steps,
        enable_model_summary=False,
    )
    trainer.fit(model)

    # check training stopped at max_epochs or max_steps
    if trainer.max_steps and not trainer.max_epochs:
        assert trainer.global_step == trainer.max_steps
Tests that max_steps can be used without max_epochs.
tests/tests_pytorch/trainer/flags/test_min_max_epochs.py