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()
      )
  
imports: import os
  from functools import partial
  from unittest import mock
  from unittest.mock import ANY, MagicMock, Mock
  import pytest
  import torch
  from lightning.fabric.accelerators.xla import _XLA_GREATER_EQUAL_2_1, XLAAccelerator
  from lightning.fabric.strategies import XLAStrategy
  from lightning.fabric.strategies.launchers.xla import _XLALauncher
  from lightning.fabric.utilities.distributed import ReduceOp
  from lightning.fabric.utilities.seed import seed_everything
  from torch.utils.data import DataLoader
  from tests_fabric.helpers.models import RandomDataset
  from tests_fabric.helpers.runif import RunIf
label_desc: Use image node_id 12 for calling a global function with example usage: test_rank_properties_access(xla_available) without return types