code: def test_fetch_ecg(return_X_y):
      try:
          data = fetch_ecg(return_X_y=return_X_y)
      except RequestException:
          pytest.skip("ECG dataset URL down")
      if return_X_y:
          assert isinstance(data, tuple)
          assert (
              isinstance(data[0][0], np.ndarray)
              and isinstance(data[0][1], np.ndarray)
              and isinstance(data[1][0], np.ndarray)
              and isinstance(data[1][1], np.ndarray)
          )
      else:
          assert isinstance(data, Bunch)
          assert (
              isinstance(data.data_train, np.ndarray)
              and isinstance(data.data_test, np.ndarray)
              and isinstance(data.target_train, np.ndarray)
              and isinstance(data.target_test, np.ndarray)
          )
  
file_path: alibi-detect/alibi_detect/tests/test_datasets.py
imports: import numpy
  import pandas
  import pytest
  from requests import RequestException
  from urllib.error import URLError
  from alibi_detect.datasets import fetch_kdd, fetch_ecg, corruption_types_cifar10c, fetch_cifar10c, fetch_attack, fetch_nab, get_list_nab
  from alibi_detect.utils.data import Bunch
label_desc: Use image node_id 2 for calling a global function with example usage: test_fetch_ecg(return_X_y) without return types