code: def test_weights_scalar_handler_wrong_setup():
      with pytest.raises(
          TypeError,
          match="Argument model should be of type torch.nn.Module",
      ):
          WeightsScalarHandler(None)
  
      model = MagicMock(spec=torch.nn.Module)
      with pytest.raises(
          TypeError, match="Argument reduction should be callable"
      ):
          WeightsScalarHandler(model, reduction=123)
  
      with pytest.raises(
          TypeError,
          match="Output of the reduction function should be a scalar",
      ):
          WeightsScalarHandler(model, reduction=lambda x: x)
  
      wrapper = WeightsScalarHandler(model)
      mock_logger = MagicMock()
      mock_engine = MagicMock()
      with pytest.raises(
          RuntimeError,
          match="Handler 'WeightsScalarHandler' works only with VisdomLogger",
      ):
          wrapper(mock_engine, mock_logger, Events.ITERATION_STARTED)
  
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 11 for calling a global function with example usage: test_weights_scalar_handler_wrong_setup() without return types