code: def test_optimizer_params():
      optimizer = torch.optim.SGD([torch.tensor(0.0)], lr=0.01)
      wrapper = OptimizerParamsHandler(
          optimizer=optimizer, param_name="lr"
      )
      mock_logger = MagicMock(spec=VisdomLogger)
      mock_logger.vis = MagicMock()
      mock_logger.executor = _DummyExecutor()
      mock_engine = MagicMock()
      mock_engine.state = State()
      mock_engine.state.iteration = 123
  
      wrapper(mock_engine, mock_logger, Events.ITERATION_STARTED)
  
      # mock_logger.vis.line.assert_called_once_with("lr/group_0", 0.01, 123)
      assert (
          len(wrapper.windows) == 1 and "lr/group_0" in wrapper.windows
      )
      assert wrapper.windows["lr/group_0"]["win"] is not None
  
      mock_logger.vis.line.assert_called_once_with(
          X=[123],
          Y=[0.01],
          env=mock_logger.vis.env,
          win=None,
          update=None,
          opts=wrapper.windows["lr/group_0"]["opts"],
          name="lr/group_0",
      )
  
      wrapper = OptimizerParamsHandler(
          optimizer=optimizer, param_name="lr", tag="generator"
      )
      mock_logger = MagicMock(spec=VisdomLogger)
      mock_logger.vis = MagicMock()
      mock_logger.executor = _DummyExecutor()
  
      wrapper(mock_engine, mock_logger, Events.ITERATION_STARTED)
  
      assert (
          len(wrapper.windows) == 1
          and "generator/lr/group_0" in wrapper.windows
      )
      assert wrapper.windows["generator/lr/group_0"]["win"] is not None
  
      mock_logger.vis.line.assert_called_once_with(
          X=[123],
          Y=[0.01],
          env=mock_logger.vis.env,
          win=None,
          update=None,
          opts=wrapper.windows["generator/lr/group_0"]["opts"],
          name="generator/lr/group_0",
      )
  
imports: import sys
  from unittest.mock import ANY, call, MagicMock, patch
  import pytest
  import torch
  from ignite.contrib.handlers.visdom_logger import _DummyExecutor, global_step_from_engine, GradsScalarHandler, OptimizerParamsHandler, OutputHandler, VisdomLogger, WeightsScalarHandler
  from ignite.engine import Engine, Events, State
label_desc: Use image node_id 2 for calling a global function with example usage: test_optimizer_params() without return types