class_docstr: The unit tests in this module make sure if the time series features are created properly
class_docstr_tok: ["The","unit","tests","in","this","module","make","sure","if","the","time","series","features","are","created","properly"]
code: def test_extract_features_for_index_based_functions(self):
      df = self.create_test_data_sample_with_time_index()
  
      settings = {
          "linear_trend_timewise": [{"attr": "slope"}],
          "linear_trend": [{"attr": "slope"}],
      }
  
      extracted_features = extract_features(
          df,
          default_fc_parameters=settings,
          column_value="val",
          column_id="id",
          column_kind="kind",
          column_sort="sort",
      )
  
      self.assertIsInstance(extracted_features, pd.DataFrame)
  
      slope_a = extracted_features[
          'a__linear_trend_timewise__attr_"slope"'
      ].values
      slope_b = extracted_features[
          'b__linear_trend_timewise__attr_"slope"'
      ].values
  
      self.assertAlmostEqual(slope_a[0], -0.001347117)
      self.assertAlmostEqual(slope_a[1], 0.052036340)
      self.assertAlmostEqual(slope_b[0], 0.021898496)
      self.assertAlmostEqual(slope_b[1], -0.012312)
  
      # Test that the index of the returned df is the ID and not the timestamp
      self.assertTrue(extracted_features.index.dtype != df.index.dtype)
      self.assertTrue(extracted_features.index.dtype == df["id"].dtype)
      self.assertEqual(
          sorted(extracted_features.index.unique().tolist()),
          sorted(df["id"].unique().tolist()),
      )
  
imports: import os
  import tempfile
  import numpy
  import pandas
  from mock import Mock
  from tests.fixtures import DataTestCase
  from tsfresh.feature_extraction.extraction import extract_features
  from tsfresh.feature_extraction.settings import ComprehensiveFCParameters, PickableSettings
  from tsfresh.utilities.distribution import IterableDistributorBaseClass, MapDistributor
label_desc: Use image node_id 5 for calling the ExtractionTestCase obj's underlying member method code with example usage: obj.test_extract_features_for_index_based_functions() without return types