def test_trainer_max_steps_and_epochs_validation(max_epochs, max_steps, incorrect_variable):
    """Don't allow max_epochs or max_steps to be less than -1 or a float."""
    with pytest.raises(
        MisconfigurationException,
        match=f"`{incorrect_variable}` must be a non-negative integer or -1",
    ):
        Trainer(max_epochs=max_epochs, max_steps=max_steps)
Don't allow max_epochs or max_steps to be less than -1 or a float.
tests/tests_pytorch/trainer/test_trainer.py