code: def _job_cli_group_test_address(mock_sdk_client, cmd, *args):
      runner = CliRunner()
  
      create_cluster_if_needed = True if cmd == "submit" else False
      # Test passing address via command line.
      result = runner.invoke(
          job_cli_group, [cmd, "--address=arg_addr", *args]
      )
      mock_sdk_client.assert_called_with(
          "arg_addr",
          create_cluster_if_needed,
          headers=None,
          verify=True,
      )
      with pytest.raises(AssertionError):
          mock_sdk_client.assert_called_with(
              "some_other_addr", True, headers=None, verify=True
          )
      check_exit_code(result, 0)
      # Test passing address via env var.
      with set_env_var("RAY_ADDRESS", "env_addr"):
          result = runner.invoke(job_cli_group, [cmd, *args])
          check_exit_code(result, 0)
          # RAY_ADDRESS is read inside the SDK client.
          mock_sdk_client.assert_called_with(
              None, create_cluster_if_needed, headers=None, verify=True
          )
      # Test passing no address.
      result = runner.invoke(job_cli_group, [cmd, *args])
      check_exit_code(result, 0)
      mock_sdk_client.assert_called_with(
          None, create_cluster_if_needed, headers=None, verify=True
      )
  
imports: from contextlib import contextmanager
  import json
  import logging
  from pathlib import Path
  import tempfile
  import os
  from unittest import mock
  import yaml
  from typing import Optional
  from click.testing import CliRunner
  import pytest
  from ray.dashboard.modules.job.cli import job_cli_group
label_desc: Use image node_id 5 for calling a global function with example usage: _job_cli_group_test_address(mock_sdk_client, cmd) without return types