def test_transform_prefitted(self):
        """Check that when multiple series are passed to fit transformers with global_fit=False,
        transform behave as expected when series_idx is specified.

        Note: the transformers are fitted independently to make the expected results more intuitive
        """
        data = [
            constant_timeseries(value=0, length=2),
            constant_timeseries(value=10, length=2),
        ]

        def get_transf(global_fit: bool, fit: bool, coef: int):
            transf = self.ExtendTransformer(global_fit=global_fit, coef=coef)
            if fit:
                transf.fit(data)
            return transf

        # multiple series, global_fit=False
        p = Pipeline([
            get_transf(global_fit=False, fit=True, coef=1),
            get_transf(global_fit=False, fit=True, coef=5),
        ])
        transformed = p.transform(data)

        # ts + (data[0][0] + 1) + (data[0][0] + 5) = 6
        np.testing.assert_array_almost_equal(
            transformed[0].values(), np.array([[6, 6]]).T
        )
        # ts + (data[1][0] + 1) + (data[1][0] + 5) = 10 + 11 + 15 = 36
        np.testing.assert_array_almost_equal(
            transformed[1].values(), np.array([[36, 36]]).T
        )
        # implicitly use the first params of each transformer
        np.testing.assert_array_almost_equal(
            transformed[0].values(), p.transform(data[0]).values()
        )
        # explicitly use the first params of each transformer
        np.testing.assert_array_almost_equal(
            transformed[0].values(), p.transform(data[0], series_idx=[0]).values()
        )
        # implicitly use the first params of each transformer
        # ts + (data[0][0] + 1) + (data[0][0] + 5) = 10 + 1 + 5 = 16
        np.testing.assert_array_almost_equal(
            np.array([[16, 16]]).T, p.transform(data[1]).values()
        )
        # explicitly use the second params of each transformer
        np.testing.assert_array_almost_equal(
            transformed[1].values(), p.transform(data[1], series_idx=[1]).values()
        )

        # multiple series, mixture of local and global transformers
        p = Pipeline([
            get_transf(global_fit=False, fit=True, coef=1),
            get_transf(global_fit=True, fit=True, coef=90),
        ])
        transformed = p.transform(data)
        # ts + (data[0][0] + 1) + (sum(data[;, 0]) + 90) = 0 + 1 + 100
        np.testing.assert_array_almost_equal(
            transformed[0].values(), np.array([[101, 101]]).T
        )
        # ts + (data[1][0] + 1) + (sum(data[;, 0]) + 90) = 10 + 11 + 100
        np.testing.assert_array_almost_equal(
            transformed[1].values(), np.array([[121, 121]]).T
        )
        # implicitly use the first params of first transformer, the second is global
        np.testing.assert_array_almost_equal(
            transformed[0].values(), p.transform(data[0]).values()
        )
        # explicitly use the first params of first transformer, the second is global
        np.testing.assert_array_almost_equal(
            transformed[0].values(), p.transform(data[0], series_idx=[0]).values()
        )
        # implicitly use the first params of first transformer, the second is global
        # ts + (data[0][0] + 1) + (sum(data[;, 0]) + 90) = 10 + 1 + 100
        np.testing.assert_array_almost_equal(
            np.array([[111, 111]]).T, p.transform(data[1]).values()
        )
        # explicitly use the second params of first transformer, the second is global
        np.testing.assert_array_almost_equal(
            transformed[1].values(), p.transform(data[1], series_idx=[1]).values()
        )

        # reversing input, and explicitly selecting reversed indexes
        assert transformed[::-1] == p.transform(data[::-1], series_idx=[1, 0])
Check that when multiple series are passed to fit transformers with global_fit=False,
        transform behave as expected when series_idx is specified.

        Note: the transformers are fitted independently to make the expected results more intuitive
        
darts/tests/dataprocessing/test_pipeline.py