def test_property_local_rank():
    """Test that the local rank in LightningModule is accessible via the Trainer."""
    model = BoringModel()
    assert model.local_rank == 0

    trainer = Mock(local_rank=123)
    model.trainer = trainer
    assert model.local_rank == 123
Test that the local rank in LightningModule is accessible via the Trainer.
tests/tests_pytorch/core/test_lightning_module.py