code: def test_fit_val_loop_config(tmpdir):
      """When either val loop or val data are missing raise warning."""
      trainer = Trainer(default_root_dir=tmpdir, max_epochs=1)
  
      # no val data has val loop
      with pytest.warns(
          UserWarning,
          match=r"You passed in a `val_dataloader` but have no `validation_step`",
      ):
          model = BoringModel()
          model.validation_step = None
          trainer.fit(model)
  
      # has val loop but no val data
      with pytest.warns(
          PossibleUserWarning,
          match=r"You defined a `validation_step` but have no `val_dataloader`",
      ):
          model = BoringModel()
          model.val_dataloader = None
          trainer.fit(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 3 for calling a global function with example usage: test_fit_val_loop_config(tmpdir) without return types