code: def test_log_metrics(tmp_path, step_idx):
      logger = CSVLogger(tmp_path)
      metrics = {
          "float": 0.3,
          "int": 1,
          "FloatTensor": torch.tensor(0.1),
          "IntTensor": torch.tensor(1),
      }
      logger.log_metrics(metrics, step_idx)
      logger.save()
  
      path_csv = os.path.join(
          logger.log_dir, ExperimentWriter.NAME_METRICS_FILE
      )
      with open(path_csv) as fp:
          lines = fp.readlines()
      assert len(lines) == 2
      assert all(n in lines[0] for n in metrics)
  
imports: import os
  from unittest.mock import MagicMock
  import fsspec
  import pytest
  import torch
  from lightning.pytorch import Trainer
  from lightning.pytorch.core.saving import load_hparams_from_yaml
  from lightning.pytorch.loggers import CSVLogger
  from lightning.pytorch.loggers.csv_logs import ExperimentWriter
  from tests_pytorch.helpers.datamodules import ClassifDataModule
  from tests_pytorch.helpers.runif import RunIf
  from tests_pytorch.helpers.simple_models import ClassificationModel
label_desc: Use image node_id 5 for calling a global function with example usage: test_log_metrics(tmp_path, step_idx) without return types