code: def test_legacy_epoch_end_hooks():
      class TrainingEpochEndModel(BoringModel):
          def training_epoch_end(self, outputs):
              pass
  
      class ValidationEpochEndModel(BoringModel):
          def validation_epoch_end(self, outputs):
              pass
  
      trainer = Mock()
      with pytest.raises(
          NotImplementedError,
          match="training_epoch_end` has been removed in v2.0",
      ):
          __verify_train_val_loop_configuration(
              trainer, TrainingEpochEndModel()
          )
      with pytest.raises(
          NotImplementedError,
          match="validation_epoch_end` has been removed in v2.0",
      ):
          __verify_train_val_loop_configuration(
              trainer, ValidationEpochEndModel()
          )
  
      class TestEpochEndModel(BoringModel):
          def test_epoch_end(self, outputs):
              pass
  
      with pytest.raises(
          NotImplementedError,
          match="validation_epoch_end` has been removed in v2.0",
      ):
          __verify_eval_loop_configuration(
              ValidationEpochEndModel(), "val"
          )
      with pytest.raises(
          NotImplementedError,
          match="test_epoch_end` has been removed in v2.0",
      ):
          __verify_eval_loop_configuration(TestEpochEndModel(), "test")
  
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 7 for calling a global function with example usage: test_legacy_epoch_end_hooks() without return types