code: def test_check_val_every_n_epoch_with_max_steps(tmpdir):
      data_samples_train = 2
      check_val_every_n_epoch = 3
      max_epochs = 4
  
      class TestModel(BoringModel):
          def __init__(self):
              super().__init__()
              self.validation_called_at_step = set()
  
          def validation_step(self, *args):
              self.validation_called_at_step.add(self.global_step)
              return super().validation_step(*args)
  
          def train_dataloader(self):
              return DataLoader(RandomDataset(32, data_samples_train))
  
      model = TestModel()
      trainer = Trainer(
          default_root_dir=tmpdir,
          max_steps=data_samples_train * max_epochs,
          check_val_every_n_epoch=check_val_every_n_epoch,
          num_sanity_val_steps=0,
      )
  
      trainer.fit(model)
  
      assert trainer.current_epoch == max_epochs
      assert trainer.global_step == max_epochs * data_samples_train
      assert list(model.validation_called_at_step) == [
          data_samples_train * check_val_every_n_epoch
      ]
  
imports: import pytest
  from lightning.pytorch.demos.boring_classes import BoringModel, RandomDataset
  from lightning.pytorch.trainer.trainer import Trainer
  from torch.utils.data import DataLoader
label_desc: Use image node_id 2 for calling a global function with example usage: test_check_val_every_n_epoch_with_max_steps(tmpdir) and returns: super, DataLoader