code: def test_rank_properties_access(xla_available):
      """Test that the strategy returns the expected values depending on whether we're in the main process or not."""
      strategy = XLAFSDPStrategy()
      strategy.cluster_environment = Mock()
  
      # we're in the main process, no processes have been launched yet
      assert not strategy._launched
      assert strategy.global_rank == 0
      assert strategy.local_rank == 0
      assert strategy.node_rank == 0
      assert strategy.world_size == 1
  
      # simulate we're in a worker process
      strategy._launched = True
      assert (
          strategy.global_rank
          == strategy.cluster_environment.global_rank()
      )
      assert (
          strategy.local_rank
          == strategy.cluster_environment.local_rank()
      )
      assert (
          strategy.node_rank == strategy.cluster_environment.node_rank()
      )
      assert (
          strategy.world_size
          == strategy.cluster_environment.world_size()
      )
  
file_path: pytorch-lightning/tests/tests_fabric/strategies/test_xla_fsdp.py
imports: import os
  from unittest import mock
  from unittest.mock import MagicMock, Mock
  import pytest
  import torch.nn
  import torch.nn
  from lightning.fabric.accelerators import XLAAccelerator
  from lightning.fabric.plugins import XLAPrecision
  from lightning.fabric.strategies import XLAFSDPStrategy
  from lightning.fabric.strategies.xla_fsdp import _activation_checkpointing_auto_wrapper, _XLAFSDPBackwardSyncControl
  from torch.optim import Adam
  from tests_fabric.helpers.runif import RunIf
label_desc: Use image node_id 4 for calling a global function with example usage: test_rank_properties_access(xla_available) without return types