code: def test_new_session_backend(_new_session, backend):
      from ....services.task.execution.api import _name_to_config_cls
  
      config_cls = _name_to_config_cls[backend]
      original_config_init = config_cls.__init__
      original_deploy_band_resources = (
          config_cls.get_deploy_band_resources
      )
      with mock.patch.object(
          config_cls, "__init__", autospec=True
      ) as config_init, mock.patch.object(
          config_cls, "get_deploy_band_resources", autospec=True
      ) as deploy_band_resources:
          return_deploy_band_resources = []
  
          def _wrap_original_deploy_band_resources(*args, **kwargs):
              nonlocal return_deploy_band_resources
              return_deploy_band_resources = (
                  original_deploy_band_resources(*args, **kwargs)
              )
              return return_deploy_band_resources
  
          config_init.side_effect = original_config_init
          deploy_band_resources.side_effect = (
              _wrap_original_deploy_band_resources
          )
          sess = _new_session(
              backend=backend,
              n_cpu=2,
              web=False,
              use_uvloop=False,
              default=True,
          )
          try:
              assert config_init.call_count > 0
              assert deploy_band_resources.call_count > 0
              worker_pools = sess.default.client._cluster._worker_pools
              assert len(worker_pools) == len(
                  return_deploy_band_resources
              )
              a = mt.ones((10, 10))
              b = a + 1
              res = b.to_numpy()
              np.testing.assert_array_equal(res, np.ones((10, 10)) + 1)
          finally:
              sess.stop_server()
  
      assert get_default_async_session() is None
  
imports: import asyncio
  import copy
  import gc
  import os
  import subprocess
  import sys
  import threading
  import tempfile
  import textwrap
  import time
  import uuid
  import weakref
  import numpy
  import pandas
  import psutil
  import pytest
  from ....None import dataframe
  from ....None import tensor
  from ....None import remote
  from ....config import option_context
  from ....core.context import get_context
  from ....lib.aio import new_isolation
  from ....storage import StorageLevel
  from ....services.storage import StorageAPI
  from ....services.task.supervisor.task import TaskProcessor
  from ....session import get_default_async_session, get_default_session, clear_default_session, new_session, execute, fetch, fetch_infos, stop_server, AsyncSession, ExecutionInfo, Profiling, Progress, _execute_with_progress
  from ....tensor.arithmetic.add import TensorAdd
  from ....tests.core import mock, check_dict_structure_same, DICT_NOT_EMPTY
  from ..local import new_cluster, _load_config
  from ..session import _IsolatedWebSession
  from ..tests.session import new_test_session
  from .modules.utils import cleanup_third_party_modules_output, get_output_filenames
label_desc: Use image node_id 2 for calling a global function with example usage: test_new_session_backend(_new_session, backend) and returns: return_deploy_band_resources