code: def test_invalid_dataloader_idx_raises_batch_start(tmp_path):
      trainer = Trainer(default_root_dir=tmp_path, fast_dev_run=True)
  
      class ExtraDataloaderIdx(BoringModel):
          def on_predict_batch_start(
              self, batch, batch_idx, dataloader_idx
          ):
              ...
  
      model = ExtraDataloaderIdx()
      with pytest.raises(
          RuntimeError,
          match="have included `dataloader_idx` in `ExtraDataloaderIdx.on_predict_batch_start",
      ):
          trainer.predict(model)
  
      class GoodDefault(BoringModel):
          def on_predict_batch_start(
              self, batch, batch_idx, dataloader_idx=0
          ):
              ...
  
      model = GoodDefault()
      trainer.predict(model)
  
      class ExtraDlIdxOtherName(BoringModel):
          def on_predict_batch_start(self, batch, batch_idx, dl_idx):
              ...
  
      model = ExtraDlIdxOtherName()
      # different names are not supported
      with pytest.raises(
          TypeError,
          match="missing 1 required positional argument: 'dl_idx",
      ):
          trainer.predict(model)
  
      class MultipleDataloader(BoringModel):
          def on_predict_batch_start(self, batch, batch_idx):
              ...
  
          def predict_dataloader(self):
              return [
                  super().predict_dataloader(),
                  super().predict_dataloader(),
              ]
  
      model = MultipleDataloader()
      with pytest.raises(
          RuntimeError,
          match="no `dataloader_idx` argument in `MultipleDataloader.on_predict_batch_start",
      ):
          trainer.predict(model)
  
      class IgnoringModel(MultipleDataloader):
          def on_predict_batch_start(self, batch, batch_idx, *_):
              ...
  
      model = IgnoringModel()
      trainer.predict(model)
  
      class IgnoringModel2(MultipleDataloader):
          def on_predict_batch_start(self, batch, batch_idx, **_):
              ...
  
      model = IgnoringModel2()
      with pytest.raises(
          RuntimeError,
          match="no `dataloader_idx` argument in `IgnoringModel2.on_predict_batch_start",
      ):
          trainer.predict(model)
  
file_path: pytorch-lightning/tests/tests_pytorch/loops/test_prediction_loop.py
imports: import itertools
  import pytest
  from lightning.pytorch import LightningModule, Trainer
  from lightning.pytorch.demos.boring_classes import BoringModel, RandomDataset
  from lightning.pytorch.overrides.distributed import _IndexBatchSamplerWrapper
  from torch.utils.data import DataLoader, DistributedSampler, SequentialSampler
label_desc: Use image node_id 5 for calling a global function with example usage: test_invalid_dataloader_idx_raises_batch_start(tmp_path) and returns: list