code: def test_attach_data_input_validation_with_none_dataloader(
      trainer_fn_name, dataloader_name, tmp_path
  ):
      """Test that passing `Trainer.method(x_dataloader=None)` with no module-method implementations available raises an
      error."""
      trainer = Trainer(default_root_dir=tmp_path, fast_dev_run=True)
      model = BoringModel()
      datamodule = BoringDataModule()
      trainer_fn = getattr(trainer, trainer_fn_name)
  
      # Pretend that these methods are not implemented
      model.train_dataloader = None
      model.val_dataloader = None
      model.test_dataloader = None
      model.predict_dataloader = None
  
      datamodule.train_dataloader = None
      datamodule.val_dataloader = None
      datamodule.test_dataloader = None
      datamodule.predict_dataloader = None
  
      with pytest.raises(
          TypeError,
          match=f"An invalid .*dataloader was passed to `Trainer.{trainer_fn_name}",
      ):
          trainer_fn(
              model, **{dataloader_name: None}, datamodule=datamodule
          )
  
      with pytest.raises(
          TypeError,
          match=f"An invalid .*dataloader was passed to `Trainer.{trainer_fn_name}",
      ):
          trainer_fn(model, **{dataloader_name: None}, datamodule=None)
  
imports: from re import escape
  from typing import Sized
  from unittest import mock
  from unittest.mock import Mock
  import lightning.fabric
  import pytest
  from lightning.fabric.utilities.distributed import DistributedSamplerWrapper
  from lightning.fabric.utilities.warnings import PossibleUserWarning
  from lightning.pytorch import Trainer
  from lightning.pytorch.demos.boring_classes import BoringDataModule, BoringModel, RandomDataset
  from lightning.pytorch.trainer.connectors.data_connector import _check_dataloader_iterable, _DataHookSelector, _DataLoaderSource, _worker_check, warning_cache
  from lightning.pytorch.trainer.states import RunningStage, TrainerFn
  from lightning.pytorch.utilities.combined_loader import CombinedLoader
  from lightning.pytorch.utilities.data import _update_dataloader
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning_utilities.test.warning import no_warning_call
  from torch import Tensor
  from torch.utils.data import BatchSampler, DataLoader, DistributedSampler, Sampler, SequentialSampler
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 20 for calling a global function with example usage: test_attach_data_input_validation_with_none_dataloader(trainer_fn_name, dataloader_name, tmp_path) without return types