def test_eval_metric_return_type(self, config):
        """Check that eval_metric's output are properly unpacked depending on input type"""
        aggregator_cls, cls_kwargs, _ = config
        aggregator = aggregator_cls(**cls_kwargs)

        if isinstance(aggregator, FittableAggregator):
            aggregator.fit(self.real_anomalies, self.mts_anomalies1)

        # Check return types
        assert isinstance(
            aggregator.eval_metric(self.real_anomalies, self.mts_anomalies1),
            float,
        )

        assert isinstance(
            aggregator.eval_metric([self.real_anomalies], [self.mts_anomalies1]),
            Sequence,
        )

        assert isinstance(
            aggregator.eval_metric(self.real_anomalies, [self.mts_anomalies1]),
            Sequence,
        )

        assert isinstance(
            aggregator.eval_metric(
                [self.real_anomalies, self.real_anomalies],
                [self.mts_anomalies1, self.mts_anomalies2],
            ),
            Sequence,
        )

        # Check if return type is the same number of series in input
        assert (
            len(
                aggregator.eval_metric(
                    [self.real_anomalies, self.real_anomalies],
                    [self.mts_anomalies1, self.mts_anomalies2],
                )
            )
            == 2
        )

        # intersection between 'anomalies' and the series in the sequence 'list_series'
        # must be non empty
        with pytest.raises(ValueError):
            aggregator.eval_metric(self.real_anomalies[:30], self.mts_anomalies1[40:])
        with pytest.raises(ValueError):
            aggregator.eval_metric(
                [self.real_anomalies, self.real_anomalies[:30]],
                [self.mts_anomalies1, self.mts_anomalies1[40:]],
            )

        # window parameter must be smaller than the length of the input (len = 100)
        with pytest.raises(ValueError):
            aggregator.eval_metric(self.real_anomalies, self.mts_anomalies1, window=101)
Check that eval_metric's output are properly unpacked depending on input type
darts/tests/ad/test_aggregators.py