code: def test_on_evaluation_epoch_end(eval_epoch_end_mock, tmpdir):
      """Tests that `on_evaluation_epoch_end` is called for `on_validation_epoch_end` and `on_test_epoch_end` hooks."""
      model = BoringModel()
  
      trainer = Trainer(
          default_root_dir=tmpdir,
          limit_train_batches=2,
          limit_val_batches=2,
          max_epochs=2,
          enable_model_summary=False,
      )
  
      trainer.fit(model)
      # sanity + 2 epochs
      assert eval_epoch_end_mock.call_count == 3
  
      trainer.test()
      # sanity + 2 epochs + called once for test
      assert eval_epoch_end_mock.call_count == 4
  
imports: from unittest import mock
  from unittest.mock import Mock, call
  import pytest
  import torch
  from lightning.fabric.accelerators.cuda import _clear_cuda_memory
  from lightning.pytorch import LightningModule, Trainer
  from lightning.pytorch.demos.boring_classes import BoringModel, RandomDataset
  from lightning.pytorch.utilities import CombinedLoader
  from torch.utils.data.dataloader import DataLoader
  from torch.utils.data.sampler import BatchSampler, RandomSampler
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 1 for calling a global function with example usage: test_on_evaluation_epoch_end(eval_epoch_end_mock, tmpdir) without return types