code: def test_csv_generation(tmp_path):
      import numpy as np
      import pandas as pd
  
      with mock.patch(
          "mlflow.experiments.fluent.search_runs",
          return_value=pd.DataFrame(
              {
                  "run_id": np.array(
                      ["all_set", "with_none", "with_nan"]
                  ),
                  "experiment_id": np.array([1, 1, 1]),
                  "param_optimizer": np.array(["Adam", None, "Adam"]),
                  "avg_loss": np.array(
                      [42.0, None, np.nan], dtype=np.float32
                  ),
              },
              columns=[
                  "run_id",
                  "experiment_id",
                  "param_optimizer",
                  "avg_loss",
              ],
          ),
      ):
          expected_csv = textwrap.dedent(
              """\
          run_id,experiment_id,param_optimizer,avg_loss
          all_set,1,Adam,42.0
          with_none,1,,
          with_nan,1,Adam,
          """
          )
          result_filename = os.path.join(tmp_path, "result.csv")
          CliRunner().invoke(
              experiments.generate_csv_with_runs,
              ["--experiment-id", "1", "--filename", result_filename],
          )
          with open(result_filename) as fd:
              assert expected_csv == fd.read()
  
file_path: mlflow/tests/test_runs.py
imports: import os
  import textwrap
  from unittest import mock
  import pytest
  from click.testing import CliRunner
  import mlflow
  from mlflow import experiments
  from mlflow.runs import list_run
label_desc: Use image node_id 3 for calling a global function with example usage: test_csv_generation(tmp_path) without return types