def test_diff_incompatible_inverse_transform_shape(self):
        """
        Tests that `Diff` throws error when given series to `inverse_transform`
        that has different number of components or samples than the fitting data.
        """
        vals = np.random.rand(10, 5, 5)
        dates = pd.date_range(start="1/1/2018", freq="W", periods=10)
        series = TimeSeries.from_times_and_values(values=vals, times=dates)
        diff = Diff(lags=1, dropna=True)
        diff.fit(series)
        series_rm_comp = TimeSeries.from_times_and_values(
            values=vals[:, 1:, :], times=dates
        )
        with pytest.raises(ValueError) as e:
            diff.inverse_transform(series_rm_comp.diff(n=1, periods=1, dropna=True))
        assert (
            f"Expected series to have {series.n_components} components; "
            f"instead, it has {series.n_components - 1}." == str(e.value)
        )
        series_rm_samp = TimeSeries.from_times_and_values(
            values=vals[:, :, 1:], times=dates
        )
        with pytest.raises(ValueError) as e:
            diff.inverse_transform(series_rm_samp.diff(n=1, periods=1, dropna=True))
        assert (
            f"Expected series to have {series.n_samples} samples; "
            f"instead, it has {series.n_samples - 1}." == str(e.value)
        )

        Tests that `Diff` throws error when given series to `inverse_transform`
        that has different number of components or samples than the fitting data.
        
darts/tests/dataprocessing/transformers/test_diff.py