code: def test_get_trials():
      with TemporaryDirectory() as tmp_dir1, TemporaryDirectory() as tmp_dir2:
          mock_trials = [
              {
                  "finalMetricData": [
                      {
                          "data": '"{\\"rmse\\": 0.8, \\"default\\": 0.3}"'
                      }
                  ],
                  "logPath": "file://localhost:{}".format(tmp_dir1),
              },
              {
                  "finalMetricData": [
                      {
                          "data": '"{\\"rmse\\": 0.9, \\"default\\": 0.2}"'
                      }
                  ],
                  "logPath": "file://localhost:{}".format(tmp_dir2),
              },
          ]
          metrics1 = {"rmse": 0.8, "precision_at_k": 0.3}
          with open(os.path.join(tmp_dir1, "metrics.json"), "w") as f:
              json.dump(metrics1, f)
          params1 = {
              "parameter_id": 1,
              "parameter_source": "algorithm",
              "parameters": {"n_factors": 100, "reg": 0.1},
          }
          with open(os.path.join(tmp_dir1, "parameter.cfg"), "w") as f:
              json.dump(params1, f)
          metrics2 = {"rmse": 0.9, "precision_at_k": 0.2}
          with open(os.path.join(tmp_dir2, "metrics.json"), "w") as f:
              json.dump(metrics2, f)
          params2 = {
              "parameter_id": 2,
              "parameter_source": "algorithm",
              "parameters": {"n_factors": 50, "reg": 0.02},
          }
          with open(os.path.join(tmp_dir2, "parameter.cfg"), "w") as f:
              json.dump(params2, f)
  
          with patch(
              "requests.get",
              side_effect=lambda url: mocked_trials_get(
                  url, mock_trials
              ),
          ):
              (
                  trials,
                  best_metrics,
                  best_params,
                  best_trial_path,
              ) = get_trials(optimize_mode="maximize")
  
          expected_trials = [
              ({"rmse": 0.8, "default": 0.3}, tmp_dir1),
              ({"rmse": 0.9, "default": 0.2}, tmp_dir2),
          ]
          assert trials == expected_trials
          assert best_metrics == metrics1
          assert best_params == params1
          assert best_trial_path == tmp_dir1
  
imports: import os
  import sys
  import json
  import pytest
  from unittest.mock import patch
  from tempfile import TemporaryDirectory
  from recommenders.tuning.nni.nni_utils import get_experiment_status, check_experiment_status, check_stopped, check_metrics_written, get_trials, NNI_STATUS_URL, NNI_TRIAL_JOBS_URL
label_desc: Use image node_id 14 for calling a global function with example usage: test_get_trials() without return types