def test_diff_inverse_transform_beyond_fit_data(self):
        """
        Tests that `Diff` class can 'undifference' data that extends beyond
         what was used to fit it (e.g. like when undifferencing a forecast of
         a differenced timeseries, so as to yield a forecast of the undifferenced
         time series)
        """

        # (`lag`, `dropna`) pairs:
        test_cases = [
            (1, True),
            (1, False),
            ([1, 2, 3, 2, 1], True),
            ([1, 2, 3, 2, 1], False),
        ]

        # Artifically truncate series:
        short_sine = self.sine_series.copy().drop_after(10)
        for lags, dropna in test_cases:
            # Fit Diff to truncated series:
            diff = Diff(lags=lags, dropna=dropna)
            diff.fit(short_sine)
            # Difference entire time series:
            to_undiff = self.sine_series.copy()
            if not isinstance(lags, Sequence):
                lags = (lags,)
            for lag in lags:
                to_undiff = to_undiff.diff(n=1, periods=lag, dropna=dropna)
            # Should be able to undifference entire series even though only fitted
            # to truncated series:
            self.assert_series_equal(
                series1=self.sine_series,
                series2=diff.inverse_transform(to_undiff),
                equal_nan=(not dropna),
            )

        Tests that `Diff` class can 'undifference' data that extends beyond
         what was used to fit it (e.g. like when undifferencing a forecast of
         a differenced timeseries, so as to yield a forecast of the undifferenced
         time series)
        
darts/tests/dataprocessing/transformers/test_diff.py