code: def test_output_handler_metric_names():
      wrapper = OutputHandler("tag", metric_names=["a", "b"])
      logger = NeptuneLogger(
          project="tests/dry-run",
          mode="debug",
      )
      mock_engine = MagicMock()
      mock_engine.state = State(metrics={"a": 12.23, "b": 23.45})
      mock_engine.state.iteration = 5
  
      wrapper(mock_engine, logger, Events.ITERATION_STARTED)
  
      assert_logger_called_once_with(logger, "tag/a", 12.23)
      assert_logger_called_once_with(logger, "tag/b", 23.45)
      logger.stop()
  
      wrapper = OutputHandler("tag", metric_names=["a"])
  
      mock_engine = MagicMock()
      mock_engine.state = State(
          metrics={"a": torch.tensor([0.0, 1.0, 2.0, 3.0])}
      )
      mock_engine.state.iteration = 5
  
      logger = NeptuneLogger(
          project="tests/dry-run",
          mode="debug",
      )
      wrapper(mock_engine, logger, Events.ITERATION_STARTED)
  
      for key, val in [
          ("tag/a/0", 0.0),
          ("tag/a/1", 1.0),
          ("tag/a/2", 2.0),
          ("tag/a/3", 3.0),
      ]:
          assert_logger_called_once_with(logger, key, val)
      logger.stop()
  
      wrapper = OutputHandler("tag", metric_names=["a", "c"])
  
      mock_engine = MagicMock()
      logger = NeptuneLogger(
          project="tests/dry-run",
          mode="debug",
      )
      mock_engine.state = State(metrics={"a": 55.56, "c": "Some text"})
      mock_engine.state.iteration = 7
  
      with pytest.warns(UserWarning):
          wrapper(mock_engine, logger, Events.ITERATION_STARTED)
  
      assert_logger_called_once_with(logger, "tag/a", 55.56)
      logger.stop()
  
      # all metrics
      wrapper = OutputHandler("tag", metric_names="all")
      logger = NeptuneLogger(
          project="tests/dry-run",
          mode="debug",
      )
      mock_engine = MagicMock()
      mock_engine.state = State(metrics={"a": 12.23, "b": 23.45})
      mock_engine.state.iteration = 5
  
      wrapper(mock_engine, logger, Events.ITERATION_STARTED)
  
      assert_logger_called_once_with(logger, "tag/a", 12.23)
      assert_logger_called_once_with(logger, "tag/b", 23.45)
      logger.stop()
  
      # log a torch tensor (ndimension = 0)
      wrapper = OutputHandler("tag", metric_names="all")
      logger = NeptuneLogger(
          project="tests/dry-run",
          mode="debug",
      )
      mock_engine = MagicMock()
      mock_engine.state = State(
          metrics={"a": torch.tensor(12.23), "b": torch.tensor(23.45)}
      )
      mock_engine.state.iteration = 5
  
      wrapper(mock_engine, logger, Events.ITERATION_STARTED)
  
      assert_logger_called_once_with(logger, "tag/a", 12.23)
      assert_logger_called_once_with(logger, "tag/b", 23.45)
      logger.stop()
  
imports: import math
  import warnings
  from unittest.mock import MagicMock
  import pytest
  import torch
  from ignite.contrib.handlers.neptune_logger import global_step_from_engine, GradsScalarHandler, NeptuneLogger, NeptuneSaver, OptimizerParamsHandler, OutputHandler, WeightsScalarHandler
  from ignite.engine import Engine, Events, State
label_desc: Use image node_id 6 for calling a global function with example usage: test_output_handler_metric_names() without return types