code: def test_eval_loop_config(tmpdir):
      """When either eval step or eval data is missing."""
      trainer = Trainer(default_root_dir=tmpdir, max_epochs=1)
  
      # has test data but no val step
      model = BoringModel()
      model.validation_step = None
      with pytest.raises(
          MisconfigurationException,
          match=r"No `validation_step\(\)` method defined",
      ):
          trainer.validate(model)
  
      # has test data but no test step
      model = BoringModel()
      model.test_step = None
      with pytest.raises(
          MisconfigurationException,
          match=r"No `test_step\(\)` method defined",
      ):
          trainer.test(model)
  
      # has predict data but no predict_step
      model = BoringModel()
      model.predict_step = None
      with pytest.raises(
          MisconfigurationException,
          match=r"`predict_step` cannot be None.",
      ):
          trainer.predict(model)
  
      # has predict data but no forward
      model = BoringModel()
      model.forward = None
      with pytest.raises(
          MisconfigurationException,
          match=r"requires `forward` method to run.",
      ):
          trainer.predict(model)
  
file_path: pytorch-lightning/tests/tests_pytorch/trainer/test_config_validator.py
imports: from unittest.mock import Mock
  import pytest
  import torch
  from lightning.fabric.utilities.warnings import PossibleUserWarning
  from lightning.pytorch import LightningDataModule, LightningModule, Trainer
  from lightning.pytorch.demos.boring_classes import BoringModel, RandomDataset
  from lightning.pytorch.trainer.configuration_validator import __verify_eval_loop_configuration, __verify_train_val_loop_configuration
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
label_desc: Use image node_id 4 for calling a global function with example usage: test_eval_loop_config(tmpdir) without return types