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 = XLAStrategy()
      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_pytorch/strategies/test_xla.py
imports: import os
  from unittest import mock
  from unittest.mock import Mock
  import torch
  from lightning.pytorch import Trainer
  from lightning.pytorch.accelerators import XLAAccelerator
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.strategies import XLAStrategy
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 2 for calling a global function with example usage: test_rank_properties_access(xla_available) without return types