code: def test_main_address_from_slurm_node_list(slurm_node_list, expected):
      """Test extracting the main node from different formats for the SLURM_NODELIST."""
      with mock.patch.dict(
          os.environ, {"SLURM_NODELIST": slurm_node_list}
      ):
          env = SLURMEnvironment()
          assert env.main_address == expected
  
file_path: pytorch-lightning/tests/tests_fabric/plugins/environments/test_slurm.py
imports: import logging
  import os
  import shutil
  import sys
  from unittest import mock
  import pytest
  from lightning.fabric.plugins.environments import SLURMEnvironment
  from lightning.fabric.utilities.warnings import PossibleUserWarning
  from lightning_utilities.test.warning import no_warning_call
  from tests_fabric.helpers.runif import RunIf
label_desc: Use image node_id 3 for calling a global function with example usage: test_main_address_from_slurm_node_list(slurm_node_list, expected) without return types