code: def test_convert_data_device(
      user_visible_devices, cuda_visible_devices, device, correct
  ):
      _cuda_visible_devices = os.getenv("CUDA_VISIBLE_DEVICES")
      _user_visible_devices = os.getenv("USER_CUDA_VISIBLE_DEVICES")
      if cuda_visible_devices is not None:
          os.environ["CUDA_VISIBLE_DEVICES"] = cuda_visible_devices
      if user_visible_devices is not None:
          os.environ["USER_CUDA_VISIBLE_DEVICES"] = user_visible_devices
      res = _convert_data_device(device)
      assert res == correct
  
      # 还原环境变量
      if _cuda_visible_devices is None:
          os.environ.pop("CUDA_VISIBLE_DEVICES", None)
      else:
          os.environ["CUDA_VISIBLE_DEVICES"] = _cuda_visible_devices
      if _user_visible_devices is None:
          os.environ.pop("USER_CUDA_VISIBLE_DEVICES", None)
      else:
          os.environ[
              "USER_CUDA_VISIBLE_DEVICES"
          ] = _user_visible_devices
  
file_path: fastNLP/tests/core/utils/test_paddle_utils.py
imports: import os
  import pytest
  from fastNLP.core.utils.paddle_utils import _convert_data_device, paddle_to, paddle_move_data_to_device
  from fastNLP.envs.imports import _NEED_IMPORT_PADDLE
label_desc: Use image node_id 1 for calling a global function with example usage: test_convert_data_device(user_visible_devices, cuda_visible_devices, device, correct) without return types