code: def test_timeseries_from_longitudinal_df(self):
      # univariate static covs: only group by "st1", keep static covs "st1"
      value_cols = ["a", "b", "c"]
      ts_groups1 = TimeSeries.from_group_dataframe(
          df=self.df_long_uni,
          group_cols="st1",
          static_cols=None,
          time_col="times",
          value_cols=value_cols,
      )
      assert len(ts_groups1) == self.n_groups
      for i, ts in enumerate(ts_groups1):
          assert ts.static_covariates.index.equals(
              pd.Index([DEFAULT_GLOBAL_STATIC_COV_NAME])
          )
          assert ts.static_covariates.shape == (1, 1)
          assert ts.static_covariates.columns.equals(pd.Index(["st1"]))
          assert (
              ts.static_covariates_values(copy=False) == [[i]]
          ).all()
  
      # multivariate static covs: only group by "st1", keep static covs "st1", "constant"
      ts_groups2 = TimeSeries.from_group_dataframe(
          df=self.df_long_multi,
          group_cols=["st1"],
          static_cols="constant",
          time_col="times",
          value_cols=value_cols,
      )
      assert len(ts_groups2) == self.n_groups
      for i, ts in enumerate(ts_groups2):
          assert ts.static_covariates.shape == (1, 2)
          assert ts.static_covariates.columns.equals(
              pd.Index(["st1", "constant"])
          )
          assert (
              ts.static_covariates_values(copy=False) == [[i, 1]]
          ).all()
  
      # multivariate static covs: group by "st1" and "st2", keep static covs "st1", "st2", "constant"
      ts_groups3 = TimeSeries.from_group_dataframe(
          df=self.df_long_multi,
          group_cols=["st1", "st2"],
          static_cols=["constant"],
          time_col="times",
          value_cols=value_cols,
      )
      assert len(ts_groups3) == self.n_groups * 2
      for idx, ts in enumerate(ts_groups3):
          i = idx // 2
          j = idx % 2
          assert ts.static_covariates.shape == (1, 3)
          assert ts.static_covariates.columns.equals(
              pd.Index(["st1", "st2", "constant"])
          )
          assert (
              ts.static_covariates_values(copy=False) == [[i, j, 1]]
          ).all()
  
      df = copy.deepcopy(self.df_long_multi)
      df.loc[:, "non_static"] = np.arange(len(df))
      # non static columns as static columns should raise an error
      with pytest.raises(ValueError):
          _ = TimeSeries.from_group_dataframe(
              df=df,
              group_cols=["st1"],
              static_cols=["non_static"],
              time_col="times",
              value_cols=value_cols,
          )
  
      # groups that are too short for TimeSeries requirements should raise an error
      with pytest.raises(ValueError):
          _ = TimeSeries.from_group_dataframe(
              df=df,
              group_cols=["st1", "non_static"],
              static_cols=None,
              time_col="times",
              value_cols=value_cols,
          )
  
imports: import copy
  import os
  import numpy
  import pandas
  import pytest
  from darts import TimeSeries, concatenate
  from darts.dataprocessing.transformers import BoxCox, Scaler
  from darts.timeseries import DEFAULT_GLOBAL_STATIC_COV_NAME, STATIC_COV_TAG
  from darts.utils.timeseries_generation import generate_index, linear_timeseries
label_desc: Use image node_id 2 for calling the TestTimeSeriesStaticCovariate obj's underlying member method code with example usage: obj.test_timeseries_from_longitudinal_df() without return types