def test_mlflow_logger_with_long_param_value(mlflow_mock, tmp_path):
    """Test that long parameter values are truncated to 250 characters."""

    def _check_value_length(value, *args, **kwargs):
        assert len(value) <= 250

    mlflow_mock.entities.Param.side_effect = _check_value_length

    logger = MLFlowLogger("test", save_dir=str(tmp_path))

    params = {"test": "test_param" * 50}
    logger.log_hyperparams(params)

    # assert_called_once_with() won't properly check the parameter value.
    logger.experiment.log_batch.assert_called_once()
Test that long parameter values are truncated to 250 characters.
tests/tests_pytorch/loggers/test_mlflow.py