def test_tuner_with_already_configured_batch_size_finder():
    """Test that an error is raised when tuner is already configured with BatchSizeFinder."""
    trainer = Trainer(callbacks=[BatchSizeFinder()])
    tuner = Tuner(trainer)
    model = BoringModel()

    with pytest.raises(ValueError, match=r"Trainer is already configured with a `BatchSizeFinder`"):
        tuner.scale_batch_size(model)
Test that an error is raised when tuner is already configured with BatchSizeFinder.
tests/tests_pytorch/tuner/test_tuning.py