code: def test_load_from_tsfile():
      """Test function for loading TS formats.
  
      Test
      1. Univariate equal length (UnitTest) returns 2D numpy X, 1D numpy y
      2. Multivariate equal length (BasicMotions) returns 3D numpy X, 1D numpy y
      3. Univariate and multivariate unequal length (PLAID) return X as DataFrame
      """
      data_path = MODULE + "/data/UnitTest/UnitTest_TRAIN.ts"
      # Test 1.1: load univariate equal length (UnitTest), should return 2D array and 1D
      # array, test first and last data
      # Test 1.2: Load a problem without y values (UnitTest),  test first and last data.
      X, y = load_from_tsfile(data_path, return_data_type="np2D")
      X2 = load_from_tsfile(
          data_path, return_y=False, return_data_type="np2D"
      )
      assert isinstance(X, np.ndarray) and isinstance(y, np.ndarray)
      assert X.ndim == 2 and X2.ndim == 2
      assert X.shape == (20, 24) and y.shape == (20,)
      assert X[0][0] == 573.0
      X2 = load_from_tsfile(
          data_path, return_y=False, return_data_type="numpy3D"
      )
      assert isinstance(X2, np.ndarray)
      assert X2.ndim == 3
      assert X2.shape == (20, 1, 24)
      assert X2[0][0][0] == 573.0
  
      # Test 2: load multivare equal length (BasicMotions), should return 3D array and 1D
      # array, test first and last data.
      data_path = MODULE + "/data/BasicMotions/BasicMotions_TRAIN.ts"
      X, y = load_from_tsfile(data_path, return_data_type="numpy3d")
      assert isinstance(X, np.ndarray) and isinstance(y, np.ndarray)
      assert X.shape == (40, 6, 100) and y.shape == (40,)
      assert X[1][2][3] == -1.898794
      X, y = load_from_tsfile(data_path)
      assert isinstance(X, pd.DataFrame) and isinstance(y, np.ndarray)
      assert X.shape == (40, 6) and y.shape == (40,)
      assert isinstance(X.iloc[1, 2], pd.Series)
      assert X.iloc[1, 2].iloc[3] == -1.898794
  
      # Test 3.1: load univariate unequal length (PLAID), should return a one column
      # dataframe,
      data_path = MODULE + "/data/PLAID/PLAID_TRAIN.ts"
      X, y = load_from_tsfile(full_file_path_and_name=data_path)
      assert isinstance(X, pd.DataFrame) and isinstance(y, np.ndarray)
      assert X.shape == (537, 1) and y.shape == (537,)
      # Test 3.2: load multivariate unequal length (JapaneseVowels), should return a X
      # columns dataframe,
      data_path = (
          MODULE + "/data/JapaneseVowels/JapaneseVowels_TRAIN.ts"
      )
      X, y = load_from_tsfile(full_file_path_and_name=data_path)
      assert isinstance(X, pd.DataFrame) and isinstance(y, np.ndarray)
      assert X.shape == (270, 12) and y.shape == (270,)
  
imports: import os
  import tempfile
  import numpy
  import pandas
  import pytest
  from pandas._testing import assert_frame_equal
  import sktime
  from sktime.datasets import generate_example_long_table, load_from_long_to_dataframe, load_from_tsfile, load_from_tsfile_to_dataframe, load_tsf_to_dataframe, write_dataframe_to_tsfile, write_panel_to_tsfile
  from sktime.datasets._data_io import MODULE, _load_provided_dataset
  from sktime.datasets._readers_writers.tsf import _convert_tsf_to_hierarchical
  from sktime.datatypes import check_is_mtype
label_desc: Use image node_id 2 for calling a global function with example usage: test_load_from_tsfile() without return types