code: def test_lr_finder_callback_val_batches(tmpdir):
      """Test that `LearningRateFinder` does not limit the number of val batches during training."""
  
      class CustomBoringModel(BoringModel):
          def __init__(self, lr):
              super().__init__()
              self.lr = lr
  
          def configure_optimizers(self):
              return torch.optim.SGD(self.parameters(), lr=self.lr)
  
      num_lr_tuner_training_steps = 5
      model = CustomBoringModel(0.1)
      trainer = Trainer(
          default_root_dir=tmpdir,
          num_sanity_val_steps=0,
          max_epochs=1,
          enable_model_summary=False,
          callbacks=[
              LearningRateFinder(
                  num_training_steps=num_lr_tuner_training_steps
              )
          ],
      )
      trainer.fit(model)
  
      assert trainer.num_val_batches[0] == len(trainer.val_dataloaders)
      assert trainer.num_val_batches[0] != num_lr_tuner_training_steps
  
imports: import logging
  import math
  import os
  from copy import deepcopy
  from typing import Any
  from unittest import mock
  import pytest
  import torch
  from lightning.pytorch import Trainer, seed_everything
  from lightning.pytorch.callbacks.lr_finder import LearningRateFinder
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.tuner.lr_finder import _LRFinder
  from lightning.pytorch.tuner.tuning import Tuner
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.types import STEP_OUTPUT
  from lightning_utilities.test.warning import no_warning_call
  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.helpers.utils import getattr_recursive
label_desc: Use image node_id 19 for calling a global function with example usage: test_lr_finder_callback_val_batches(tmpdir) and returns: torch