def test_augmented_dickey_fuller(self):
        # todo: add unit test for the values of the test statistic

        # the adf hypothesis test checks for unit roots,
        # so H_0 = {random drift} vs H_1 = {AR(1) model}

        # H0 is true
        np.random.seed(seed=42)
        x = np.cumsum(np.random.uniform(size=100))
        param = [
            {"autolag": "BIC", "attr": "teststat"},
            {"autolag": "BIC", "attr": "pvalue"},
            {"autolag": "BIC", "attr": "usedlag"},
        ]
        expected_index = [
            'attr_"teststat"__autolag_"BIC"',
            'attr_"pvalue"__autolag_"BIC"',
            'attr_"usedlag"__autolag_"BIC"',
        ]

        res = augmented_dickey_fuller(x=x, param=param)
        res = pd.Series(dict(res))
        self.assertCountEqual(list(res.index), expected_index)
        self.assertGreater(res['attr_"pvalue"__autolag_"BIC"'], 0.10)
        self.assertEqual(res['attr_"usedlag"__autolag_"BIC"'], 0)

        # H0 should be rejected for AR(1) model with x_{t} = 1/2 x_{t-1} + e_{t}
        np.random.seed(seed=42)
        e = np.random.normal(0.1, 0.1, size=100)
        m = 50
        x = [0] * m
        x[0] = 100
        for i in range(1, m):
            x[i] = x[i - 1] * 0.5 + e[i]
        param = [
            {"autolag": "AIC", "attr": "teststat"},
            {"autolag": "AIC", "attr": "pvalue"},
            {"autolag": "AIC", "attr": "usedlag"},
        ]
        expected_index = [
            'attr_"teststat"__autolag_"AIC"',
            'attr_"pvalue"__autolag_"AIC"',
            'attr_"usedlag"__autolag_"AIC"',
        ]

        res = augmented_dickey_fuller(x=x, param=param)
        res = pd.Series(dict(res))
        self.assertCountEqual(list(res.index), expected_index)
        self.assertLessEqual(res['attr_"pvalue"__autolag_"AIC"'], 0.05)
        self.assertEqual(res['attr_"usedlag"__autolag_"AIC"'], 0)

        # Check if LinAlgError and ValueError are catched
        res_linalg_error = augmented_dickey_fuller(
            x=np.repeat(np.nan, 100), param=param
        )
        res_value_error = augmented_dickey_fuller(x=[], param=param)
        for index, val in res_linalg_error:
            self.assertIsNaN(val)
        for index, val in res_value_error:
            self.assertIsNaN(val)

        # Should return NaN if "attr" is unknown
        res_attr_error = augmented_dickey_fuller(
            x=x, param=[{"autolag": "AIC", "attr": ""}]
        )
        for index, val in res_attr_error:
            self.assertIsNaN(val)