code: def test_calc_mem_per_ray_worker_node():
      assert _calc_mem_per_ray_worker_node(
          4, 1000000, 400000, 100000
      ) == (
          120000,
          80000,
          None,
      )
      assert _calc_mem_per_ray_worker_node(
          4, 1000000, 400000, 70000
      ) == (
          130000,
          70000,
          None,
      )
      assert _calc_mem_per_ray_worker_node(
          4, 1000000, 400000, None
      ) == (
          140000,
          60000,
          None,
      )
      assert _calc_mem_per_ray_worker_node(
          4, 1000000, 200000, None
      ) == (
          160000,
          40000,
          None,
      )
  
file_path: ray/python/ray/tests/spark/test_utils.py
imports: from unittest.mock import patch
  import os
  import re
  import sys
  import pytest
  from ray.util.spark.utils import get_spark_task_assigned_physical_gpus, _calc_mem_per_ray_worker_node, _get_avail_mem_per_ray_worker_node
  from ray.util.spark.cluster_init import _convert_ray_node_options, _verify_node_options, _append_default_spilling_dir_config
label_desc: Use image node_id 2 for calling a global function with example usage: test_calc_mem_per_ray_worker_node() without return types