def test_comet_logger_experiment_name(comet_mock):
    """Test that Comet Logger experiment name works correctly."""
    api_key = "api_key"
    experiment_name = "My Experiment Name"

    comet_start = comet_mock.start

    # here we use old style arg "experiment_name" (new one is "name")
    logger = CometLogger(api_key=api_key, experiment_name=experiment_name)
    comet_start.assert_called_once_with(
        api_key=api_key,
        workspace=None,
        project=None,
        experiment_key=None,
        mode=None,
        online=None,
        experiment_config=comet_mock.ExperimentConfig(),
    )
    # check that we saved "experiment name" in kwargs as new "name" arg
    assert logger._kwargs["name"] == experiment_name
    assert "experiment_name" not in logger._kwargs

    # check that "experiment name" was passed to experiment config correctly
    assert call(experiment_name=experiment_name) not in comet_mock.ExperimentConfig.call_args_list
    assert call(name=experiment_name) in comet_mock.ExperimentConfig.call_args_list
Test that Comet Logger experiment name works correctly.
tests/tests_pytorch/loggers/test_comet.py