code: def test_batch_size_finder_callback_val_batches(tmpdir):
      """Test that `BatchSizeFinder` does not limit the number of val batches during training."""
      steps_per_trial = 2
      model = BatchSizeModel(batch_size=16)
      trainer = Trainer(
          default_root_dir=tmpdir,
          num_sanity_val_steps=0,
          max_epochs=1,
          enable_model_summary=False,
          callbacks=[
              BatchSizeFinder(
                  steps_per_trial=steps_per_trial, max_trials=1
              )
          ],
      )
      trainer.fit(model)
  
      assert trainer.num_val_batches[0] == len(trainer.val_dataloaders)
      assert trainer.num_val_batches[0] != steps_per_trial
  
imports: import logging
  import os
  from copy import deepcopy
  from unittest.mock import patch
  import pytest
  import torch
  from lightning.pytorch import Trainer
  from lightning.pytorch.callbacks.batch_size_finder import BatchSizeFinder
  from lightning.pytorch.demos.boring_classes import BoringDataModule, BoringModel, RandomDataset
  from lightning.pytorch.tuner.tuning import Tuner
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning_utilities.test.warning import no_warning_call
  from torch.utils.data import DataLoader
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 21 for calling a global function with example usage: test_batch_size_finder_callback_val_batches(tmpdir) without return types