code: def test_fabric_optimizer_steps():
      """Test that the FabricOptimizer forwards the step() and zero_grad() calls to the wrapped optimizer."""
      optimizer = Mock(spec=torch.optim.Adam)
      strategy = Mock(spec=["optimizer_step"])
      strategy.optimizer_step.return_value = 123
      fabric_optimizer = _FabricOptimizer(
          optimizer=optimizer, strategy=strategy
      )
      step_output = fabric_optimizer.step()
      assert step_output == 123
      strategy.optimizer_step.assert_called_once_with(optimizer)
  
      strategy.reset_mock()
  
      # with closure as input
      closure = Mock()
      fabric_optimizer.step(closure=closure)
      strategy.optimizer_step.assert_called_once_with(
          optimizer, closure=closure
      )
  
      # with model as optimizer
      strategy = Mock(spec=["optimizer_step", "model"])
      fabric_optimizer = _FabricOptimizer(
          optimizer=optimizer, strategy=strategy
      )
      fabric_optimizer.step()
      strategy.optimizer_step.assert_called_once_with(strategy.model)
  
imports: from unittest import mock
  from unittest.mock import Mock, call
  import pytest
  import torch
  from lightning.fabric.fabric import Fabric
  from lightning.fabric.plugins import Precision
  from lightning.fabric.utilities.device_dtype_mixin import _DeviceDtypeModuleMixin
  from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_2_1
  from lightning.fabric.wrappers import _FabricDataLoader, _FabricModule, _FabricOptimizer, _unwrap_objects, is_wrapped
  from torch.utils.data import BatchSampler, DistributedSampler
  from torch.utils.data.dataloader import DataLoader
  from tests_fabric.helpers.runif import RunIf
label_desc: Use image node_id 14 for calling a global function with example usage: test_fabric_optimizer_steps() without return types