def assert_series_equal(
        self,
        series1: TimeSeries,
        series2: TimeSeries,
        equal_nan: bool,
        to_compare: Optional[np.ndarray] = None,
    ):
        """
        Helper to compare series differenced by `Diff`.

        Parameters
        ----------
            series1
                First `TimeSeries` object to compare.
            series2
                Second `TimeSeries` object to compare.
            equal_nan
                Whether to compare `NaN` values as equal (see `help(np.testing.assert_allclose)`); should set
                `equal_nan=(not dropna)` (i.e. should throw error if there are `NaN` values when user has requested
                for them to be dropped).
            to_compare
                boolean `np.ndarray` which specifies which subset of columns should be compared in `series1` and
                `series2`. Used when checking that components not specified by `component_mask` have NOT been
                differenced after `fit`ing (i.e. `to_compare = ~component_mask`). If `to_compare = None`, all
                columns in `series1` and `series2` are compared.
        """
        if to_compare is not None:
            series1 = series1.drop_columns(series1.columns[~to_compare])
            series2 = series2.drop_columns(series2.columns[~to_compare])
        np.testing.assert_allclose(
            series1.all_values(), series2.all_values(), atol=1e-8, equal_nan=equal_nan
        )
        assert series1.time_index.equals(series2.time_index)

        Helper to compare series differenced by `Diff`.

        Parameters
        ----------
            series1
                First `TimeSeries` object to compare.
            series2
                Second `TimeSeries` object to compare.
            equal_nan
                Whether to compare `NaN` values as equal (see `help(np.testing.assert_allclose)`); should set
                `equal_nan=(not dropna)` (i.e. should throw error if there are `NaN` values when user has requested
                for them to be dropped).
            to_compare
                boolean `np.ndarray` which specifies which subset of columns should be compared in `series1` and
                `series2`. Used when checking that components not specified by `component_mask` have NOT been
                differenced after `fit`ing (i.e. `to_compare = ~component_mask`). If `to_compare = None`, all
                columns in `series1` and `series2` are compared.
        
darts/tests/dataprocessing/transformers/test_diff.py