code: def test_auto_scale_batch_size_duplicate_attribute_warning(tmpdir):
      """Test for a warning when model.batch_size and model.hparams.batch_size both present."""
  
      class TestModel(BoringModel):
          def __init__(self, batch_size=1):
              super().__init__()
              # now we have model.batch_size and model.hparams.batch_size
              self.batch_size = 1
              self.save_hyperparameters()
  
      model = TestModel()
      trainer = Trainer(
          default_root_dir=tmpdir, max_steps=1, max_epochs=1000
      )
      tuner = Tuner(trainer)
  
      expected_message = "Field `model.batch_size` and `model.hparams.batch_size` are mutually exclusive!"
      with pytest.warns(UserWarning, match=expected_message):
          tuner.scale_batch_size(model)
  
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 6 for calling a global function with example usage: test_auto_scale_batch_size_duplicate_attribute_warning(tmpdir) without return types