code: def test_evaluation_loop_dataloader_iter_multiple_dataloaders(
      tmp_path,
  ):
      trainer = Trainer(
          default_root_dir=tmp_path,
          limit_val_batches=1,
          enable_model_summary=False,
          enable_checkpointing=False,
          logger=False,
          devices=1,
      )
  
      class MyModel(LightningModule):
          batch_start_ins = []
          step_outs = []
          batch_end_ins = []
  
          def on_validation_batch_start(
              self, batch, batch_idx, dataloader_idx
          ):
              self.batch_start_ins.append(
                  (batch, batch_idx, dataloader_idx)
              )
  
          def validation_step(self, dataloader_iter):
              self.step_outs.append(next(dataloader_iter))
  
          def on_validation_batch_end(
              self, outputs, batch, batch_idx, dataloader_idx
          ):
              self.batch_end_ins.append(
                  (batch, batch_idx, dataloader_idx)
              )
  
      model = MyModel()
      trainer.validate(model, {"a": [0, 1], "b": [2, 3]})
  
      # in on_*_batch_start, the dataloader_idx and batch_idx are not yet known
      # we only get the updated indices once we fetch from the iterator in the step-method
      assert model.batch_start_ins == [(None, 0, 0), (0, 0, 0)]
      assert model.step_outs == [(0, 0, 0), (2, 0, 1)]
      assert model.batch_end_ins == model.step_outs
  
imports: from unittest import mock
  from unittest.mock import Mock, call
  import pytest
  import torch
  from lightning.fabric.accelerators.cuda import _clear_cuda_memory
  from lightning.pytorch import LightningModule, Trainer
  from lightning.pytorch.demos.boring_classes import BoringModel, RandomDataset
  from lightning.pytorch.utilities import CombinedLoader
  from torch.utils.data.dataloader import DataLoader
  from torch.utils.data.sampler import BatchSampler, RandomSampler
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 5 for calling a global function with example usage: test_evaluation_loop_dataloader_iter_multiple_dataloaders(tmp_path) without return types