def test_fft_coefficient(self):
        x = range(10)
        param = [
            {"coeff": 0, "attr": "real"},
            {"coeff": 1, "attr": "real"},
            {"coeff": 2, "attr": "real"},
            {"coeff": 0, "attr": "imag"},
            {"coeff": 1, "attr": "imag"},
            {"coeff": 2, "attr": "imag"},
            {"coeff": 0, "attr": "angle"},
            {"coeff": 1, "attr": "angle"},
            {"coeff": 2, "attr": "angle"},
            {"coeff": 0, "attr": "abs"},
            {"coeff": 1, "attr": "abs"},
            {"coeff": 2, "attr": "abs"},
        ]
        expected_index = [
            'attr_"real"__coeff_0',
            'attr_"real"__coeff_1',
            'attr_"real"__coeff_2',
            'attr_"imag"__coeff_0',
            'attr_"imag"__coeff_1',
            'attr_"imag"__coeff_2',
            'attr_"angle"__coeff_0',
            'attr_"angle"__coeff_1',
            'attr_"angle"__coeff_2',
            'attr_"abs"__coeff_0',
            'attr_"abs"__coeff_1',
            'attr_"abs"__coeff_2',
        ]

        res = pd.Series(dict(fft_coefficient(x, param)))
        self.assertCountEqual(list(res.index), expected_index)
        self.assertAlmostEqual(res['attr_"imag"__coeff_0'], 0, places=6)
        self.assertAlmostEqual(res['attr_"real"__coeff_0'], sum(x), places=6)
        self.assertAlmostEqual(res['attr_"angle"__coeff_0'], 0, places=6)
        self.assertAlmostEqual(res['attr_"abs"__coeff_0'], sum(x), places=6)

        x = [0, 1, 0, 0]
        res = pd.Series(dict(fft_coefficient(x, param)))
        # see documentation of fft in numpy
        # should return array([1. + 0.j, 0. - 1.j, -1. + 0.j])
        self.assertAlmostEqual(res['attr_"imag"__coeff_0'], 0, places=6)
        self.assertAlmostEqual(res['attr_"real"__coeff_0'], 1, places=6)
        self.assertAlmostEqual(res['attr_"imag"__coeff_1'], -1, places=6)
        self.assertAlmostEqual(res['attr_"angle"__coeff_1'], -90, places=6)
        self.assertAlmostEqual(res['attr_"real"__coeff_1'], 0, places=6)
        self.assertAlmostEqual(res['attr_"imag"__coeff_2'], 0, places=6)
        self.assertAlmostEqual(res['attr_"real"__coeff_2'], -1, places=6)

        # test what happens if coeff is biger than time series lenght
        x = range(5)
        param = [{"coeff": 10, "attr": "real"}]
        expected_index = ['attr_"real"__coeff_10']

        res = pd.Series(dict(fft_coefficient(x, param)))
        self.assertCountEqual(list(res.index), expected_index)
        self.assertIsNaN(res['attr_"real"__coeff_10'])