code: def test_output_handler_with_global_step_from_engine():
      mock_another_engine = MagicMock()
      mock_another_engine.state = State()
      mock_another_engine.state.epoch = 10
      mock_another_engine.state.output = 12.345
  
      wrapper = OutputHandler(
          "tag",
          output_transform=lambda x: {"loss": x},
          global_step_transform=global_step_from_engine(
              mock_another_engine
          ),
      )
  
      mock_logger = MagicMock(spec=ClearMLLogger)
      mock_logger.clearml_logger = MagicMock()
  
      mock_engine = MagicMock()
      mock_engine.state = State()
      mock_engine.state.epoch = 1
      mock_engine.state.output = 0.123
  
      wrapper(mock_engine, mock_logger, Events.EPOCH_STARTED)
      assert mock_logger.clearml_logger.report_scalar.call_count == 1
      mock_logger.clearml_logger.report_scalar.assert_has_calls(
          [
              call(
                  title="tag",
                  series="loss",
                  iteration=mock_another_engine.state.epoch,
                  value=mock_engine.state.output,
              )
          ]
      )
  
      mock_another_engine.state.epoch = 11
      mock_engine.state.output = 1.123
  
      wrapper(mock_engine, mock_logger, Events.EPOCH_STARTED)
      assert mock_logger.clearml_logger.report_scalar.call_count == 2
      mock_logger.clearml_logger.report_scalar.assert_has_calls(
          [
              call(
                  title="tag",
                  series="loss",
                  iteration=mock_another_engine.state.epoch,
                  value=mock_engine.state.output,
              )
          ]
      )
  
imports: import math
  import os
  from collections import defaultdict
  from unittest.mock import ANY, call, MagicMock, patch
  import clearml
  import pytest
  import torch
  from clearml.binding.frameworks import WeightsFileHandler
  from clearml.model import Framework
  import ignite.distributed
  from ignite.contrib.handlers.clearml_logger import ClearMLLogger, ClearMLSaver, global_step_from_engine, GradsHistHandler, GradsScalarHandler, OptimizerParamsHandler, OutputHandler, WeightsHistHandler, WeightsScalarHandler
  from ignite.engine import Engine, Events, State
  from ignite.handlers import Checkpoint
label_desc: Use image node_id 9 for calling a global function with example usage: test_output_handler_with_global_step_from_engine() without return types