code: def test_add_features_from_different_sources():
      pd = pytest.importorskip("pandas")
      n_row = 100
      n_col = 5
      X = np.random.random((n_row, n_col))
      xxs = [X, sparse.csr_matrix(X), pd.DataFrame(X)]
      names = [f"col_{i}" for i in range(n_col)]
      seq = _create_sequence_from_ndarray(X, 1, 30)
      seq_ds = lgb.Dataset(
          seq, feature_name=names, free_raw_data=False
      ).construct()
      npy_list_ds = lgb.Dataset(
          [X[: n_row // 2, :], X[n_row // 2 :, :]],
          feature_name=names,
          free_raw_data=False,
      ).construct()
      immergeable_dds = [seq_ds, npy_list_ds]
      for x_1 in xxs:
          # test that method works even with free_raw_data=True
          d1 = lgb.Dataset(
              x_1, feature_name=names, free_raw_data=True
          ).construct()
          d2 = lgb.Dataset(
              x_1, feature_name=names, free_raw_data=True
          ).construct()
          d1.add_features_from(d2)
          assert d1.data is None
  
          # test that method works but sets raw data to None in case of immergeable data types
          d1 = lgb.Dataset(
              x_1, feature_name=names, free_raw_data=False
          ).construct()
          for d2 in immergeable_dds:
              d1.add_features_from(d2)
              assert d1.data is None
  
          # test that method works for different data types
          d1 = lgb.Dataset(
              x_1, feature_name=names, free_raw_data=False
          ).construct()
          res_feature_names = deepcopy(names)
          for idx, x_2 in enumerate(xxs, 2):
              original_type = type(d1.get_data())
              d2 = lgb.Dataset(
                  x_2, feature_name=names, free_raw_data=False
              ).construct()
              d1.add_features_from(d2)
              assert isinstance(d1.get_data(), original_type)
              assert d1.get_data().shape == (n_row, n_col * idx)
              res_feature_names += [f"D{idx}_{name}" for name in names]
              assert d1.feature_name == res_feature_names
  
imports: import filecmp
  import numbers
  import re
  from copy import deepcopy
  from os import getenv
  from pathlib import Path
  import numpy
  import pytest
  from scipy import sparse
  from sklearn.datasets import dump_svmlight_file, load_svmlight_file
  from sklearn.model_selection import train_test_split
  import lightgbm
  from lightgbm.compat import PANDAS_INSTALLED, pd_DataFrame, pd_Series
  from .utils import dummy_obj, load_breast_cancer, mse_obj, np_assert_array_equal
label_desc: Use image node_id 13 for calling a global function with example usage: test_add_features_from_different_sources() without return types