code: def test_fabric_log_dict():
      logger = Mock()
      module = BoringModel()
      fabric = Fabric(loggers=[logger])
      wrapped_module = fabric.setup(module)
  
      # unsupported data type
      with pytest.raises(
          ValueError, match="`list` values cannot be logged"
      ):
          wrapped_module.log_dict({"invalid": [1, 2, 3]})
  
      # nested dicts
      with pytest.raises(
          ValueError, match="nested dictionaries cannot be logged"
      ):
          wrapped_module.log_dict({"nested": {"nested": 1}})
  
      # supported data types
      wrapped_module.log_dict(
          {"int": 1, "float": 0.1, "tensor": torch.tensor(0.1)}
      )
      logger.log_metrics.assert_called_with(
          metrics={"int": 1, "float": 0.1, "tensor": torch.tensor(0.1)},
          step=None,
      )
  
      # logger=False
      logger.reset_mock()
      wrapped_module.log_dict({"nothing": 1}, logger=False)
      logger.log_metrics.assert_not_called()
  
imports: import sys
  import weakref
  from unittest.mock import Mock
  import pytest
  import torch
  from lightning.fabric import Fabric
  from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_1_13, _TORCH_GREATER_EQUAL_2_0
  from lightning.pytorch import LightningModule, Trainer
  from lightning.pytorch.core.module import _TrainerFabricShim
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.loggers import TensorBoardLogger
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from torch import nn
  from torch.optim import SGD, Adam
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 22 for calling a global function with example usage: test_fabric_log_dict() without return types