code: def test_output_handler_metric_names():
      wrapper = OutputHandler("tag", metric_names=["a", "b", "c"])
      mock_logger = MagicMock(spec=PolyaxonLogger)
      mock_logger.log_metrics = MagicMock()
  
      mock_engine = MagicMock()
      mock_engine.state = State(
          metrics={"a": 12.23, "b": 23.45, "c": torch.tensor(10.0)}
      )
      mock_engine.state.iteration = 5
  
      wrapper(mock_engine, mock_logger, Events.ITERATION_STARTED)
  
      assert mock_logger.log_metrics.call_count == 1
      mock_logger.log_metrics.assert_called_once_with(
          step=5, **{"tag/a": 12.23, "tag/b": 23.45, "tag/c": 10.0}
      )
  
      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
  
      mock_logger = MagicMock(spec=PolyaxonLogger)
      mock_logger.log_metrics = MagicMock()
  
      wrapper(mock_engine, mock_logger, Events.ITERATION_STARTED)
  
      assert mock_logger.log_metrics.call_count == 1
      mock_logger.log_metrics.assert_has_calls(
          [
              call(
                  step=5,
                  **{
                      "tag/a/0": 0.0,
                      "tag/a/1": 1.0,
                      "tag/a/2": 2.0,
                      "tag/a/3": 3.0,
                  },
              )
          ],
          any_order=True,
      )
  
      wrapper = OutputHandler("tag", metric_names=["a", "c"])
  
      mock_engine = MagicMock()
      mock_engine.state = State(metrics={"a": 55.56, "c": "Some text"})
      mock_engine.state.iteration = 7
  
      mock_logger = MagicMock(spec=PolyaxonLogger)
      mock_logger.log_metrics = MagicMock()
  
      with pytest.warns(UserWarning):
          wrapper(mock_engine, mock_logger, Events.ITERATION_STARTED)
  
      assert mock_logger.log_metrics.call_count == 1
      mock_logger.log_metrics.assert_has_calls(
          [call(step=7, **{"tag/a": 55.56})], any_order=True
      )
  
      # all metrics
      wrapper = OutputHandler("tag", metric_names="all")
      mock_logger = MagicMock(spec=PolyaxonLogger)
      mock_logger.log_metrics = MagicMock()
  
      mock_engine = MagicMock()
      mock_engine.state = State(
          metrics={"a": 12.23, "b": 23.45, "c": torch.tensor(10.0)}
      )
      mock_engine.state.iteration = 5
  
      wrapper(mock_engine, mock_logger, Events.ITERATION_STARTED)
  
      assert mock_logger.log_metrics.call_count == 1
      mock_logger.log_metrics.assert_called_once_with(
          step=5, **{"tag/a": 12.23, "tag/b": 23.45, "tag/c": 10.0}
      )
  
file_path: ignite/tests/ignite/contrib/handlers/test_polyaxon_logger.py
imports: import os
  from unittest.mock import call, MagicMock
  import pytest
  import torch
  from ignite.contrib.handlers.polyaxon_logger import global_step_from_engine, OptimizerParamsHandler, OutputHandler, PolyaxonLogger
  from ignite.engine import Engine, Events, State
label_desc: Use image node_id 3 for calling a global function with example usage: test_output_handler_metric_names() without return types