code: def test_ls_with_cfg(mock_print_format_output, start_ray, tmpdir):
      experiment_name = "test_ls_with_cfg"
      experiment_path = os.path.join(str(tmpdir), experiment_name)
      tune.run(
          "__fake",
          name=experiment_name,
          stop={"training_iteration": 1},
          config={"test_variable": tune.grid_search(list(range(5)))},
          storage_path=str(tmpdir),
      )
  
      columns = [CONFIG_PREFIX + "/test_variable", "trial_id"]
      limit = 4
  
      commands.list_trials(
          experiment_path, info_keys=columns, limit=limit
      )
  
      # The dataframe that is printed as a table is the first arg of the last
      # call made to `ray.tune.cli.commands.print_format_output`.
      mock_print_format_output.assert_called()
      args, _ = mock_print_format_output.call_args_list[-1]
      df = args[0]
      assert sorted(df.columns.to_list()) == sorted(columns), df
      assert len(df.index) == limit, df
  
imports: import click
  import os
  import pytest
  import random
  import subprocess
  import sys
  import time
  from unittest import mock
  import ray
  import ray.train
  from ray import tune
  from ray.rllib import _register_all
  from ray.tune.cli import commands
  from ray.tune.result import CONFIG_PREFIX
  from ray.train.tests.util import create_dict_checkpoint
label_desc: Use image node_id 4 for calling a global function with example usage: test_ls_with_cfg(mock_print_format_output, start_ray, tmpdir) without return types