code: def test_fit_twice(tmpdir):
      epochs = []
  
      class TestModel(BoringModel):
          def on_train_epoch_end(self, *_):
              epochs.append(self.current_epoch)
  
      trainer = Trainer(
          max_epochs=2,
          limit_train_batches=1,
          limit_val_batches=1,
          default_root_dir=tmpdir,
          logger=False,
          enable_checkpointing=False,
          enable_model_summary=False,
          enable_progress_bar=False,
      )
      trainer.fit(TestModel())
      trainer.fit_loop.max_epochs = 4
      trainer.fit(TestModel())
      assert epochs == [0, 1, 2, 3]
  
imports: import glob
  import logging
  import os
  import pickle
  from copy import deepcopy
  from typing import Generic, Mapping, TypeVar
  import cloudpickle
  import pytest
  import torch
  from lightning.fabric import seed_everything
  from lightning.pytorch import Callback, Trainer
  from lightning.pytorch.callbacks import ModelCheckpoint
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.trainer.states import TrainerFn
  from lightning_utilities.test.warning import no_warning_call
  from torch import Tensor
  import tests_pytorch.helpers.pipelines
  import tests_pytorch.helpers.utils
  from tests_pytorch.helpers.datamodules import ClassifDataModule
  from tests_pytorch.helpers.runif import RunIf
  from tests_pytorch.helpers.simple_models import ClassificationModel
  from tests_pytorch.loops.test_loops import CustomException
label_desc: Use image node_id 4 for calling a global function with example usage: test_fit_twice(tmpdir) without return types