code: def test_lightning_getattr():
      """Test that the lightning_getattr works in all cases."""
      models, _ = model_and_trainer_cases()
      *__, model5, model6, model7, model8 = models
      for i, m in enumerate(models[:3]):
          value = lightning_getattr(m, "learning_rate")
          assert value == i, "attribute not correctly extracted"
  
      assert (
          lightning_getattr(model5, "batch_size") == 8
      ), "batch_size not correctly extracted"
      assert (
          lightning_getattr(model6, "batch_size") == 8
      ), "batch_size not correctly extracted"
      assert (
          lightning_getattr(model7, "batch_size") == 8
      ), "batch_size not correctly extracted"
      assert (
          lightning_getattr(model8, "batch_size") == 2
      ), "batch_size not correctly extracted"
  
      for m in models:
          with pytest.raises(
              AttributeError,
              match="is neither stored in the model namespace nor the `hparams` namespace/dict, nor the datamodule.",
          ):
              lightning_getattr(m, "this_attr_not_exist")
  
file_path: pytorch-lightning/tests/tests_pytorch/utilities/test_parsing.py
imports: import inspect
  import threading
  import pytest
  from lightning.pytorch import LightningDataModule, LightningModule, Trainer
  from lightning.pytorch.utilities.parsing import _get_init_args, clean_namespace, collect_init_args, is_picklable, lightning_getattr, lightning_hasattr, lightning_setattr, parse_class_init_keys
  from torch.jit import ScriptModule
label_desc: Use image node_id 3 for calling a global function with example usage: test_lightning_getattr() without return types