def test_FittableAggregator_fit_wrong_inputs(self, config):
        """Check that exception is raised when fit() arguments are incorrects"""
        aggregator_cls, cls_kwargs, _ = config
        aggregator = aggregator_cls(**cls_kwargs)

        # fit on sequence with series that have different width
        with pytest.raises(ValueError):
            aggregator.fit(
                [self.real_anomalies, self.real_anomalies],
                [self.mts_anomalies1, self.mts_anomalies3],
            )

        # fit on a (sequence of) univariate series
        with pytest.raises(ValueError):
            aggregator.fit(self.real_anomalies, self.real_anomalies)
        with pytest.raises(ValueError):
            aggregator.fit(self.real_anomalies, [self.real_anomalies])
        with pytest.raises(ValueError):
            aggregator.fit(
                [self.real_anomalies, self.real_anomalies],
                [self.mts_anomalies1, self.real_anomalies],
            )

        # fit on a (sequence of) non binary series
        with pytest.raises(ValueError):
            aggregator.fit(self.real_anomalies, self.mts_train)
        with pytest.raises(ValueError):
            aggregator.fit(self.real_anomalies, [self.mts_train])
        with pytest.raises(ValueError):
            aggregator.fit(
                [self.real_anomalies, self.real_anomalies],
                [self.mts_anomalies1, self.mts_train],
            )

        # fit on a (sequence of) probabilistic series
        with pytest.raises(ValueError):
            aggregator.fit(self.real_anomalies, self.mts_probabilistic)
        with pytest.raises(ValueError):
            aggregator.fit(self.real_anomalies, [self.mts_probabilistic])
        with pytest.raises(ValueError):
            aggregator.fit(
                [self.real_anomalies, self.real_anomalies],
                [self.mts_anomalies1, self.mts_probabilistic],
            )

        # input an element that is not a series
        with pytest.raises(ValueError):
            aggregator.fit(self.real_anomalies, "random")
        with pytest.raises(ValueError):
            aggregator.fit(self.real_anomalies, [self.mts_anomalies1, "random"])
        with pytest.raises(ValueError):
            aggregator.fit(self.real_anomalies, [self.mts_anomalies1, 1])

        # fit on a (sequence of) multivariate anomalies
        with pytest.raises(ValueError):
            aggregator.fit(self.mts_anomalies1, self.mts_anomalies1)
        with pytest.raises(ValueError):
            aggregator.fit([self.mts_anomalies1], [self.mts_anomalies1])
        with pytest.raises(ValueError):
            aggregator.fit(
                [self.real_anomalies, self.mts_anomalies1],
                [self.mts_anomalies1, self.mts_anomalies1],
            )

        # fit on a (sequence of) non binary anomalies
        with pytest.raises(ValueError):
            aggregator.fit(self.train, self.mts_anomalies1)
        with pytest.raises(ValueError):
            aggregator.fit([self.train], self.mts_anomalies1)
        with pytest.raises(ValueError):
            aggregator.fit(
                [self.real_anomalies, self.train],
                [self.mts_anomalies1, self.mts_anomalies1],
            )

        # fit on a (sequence of) probabilistic anomalies
        with pytest.raises(ValueError):
            aggregator.fit(self.mts_probabilistic, self.mts_anomalies1)
        with pytest.raises(ValueError):
            aggregator.fit([self.mts_probabilistic], self.mts_anomalies1)
        with pytest.raises(ValueError):
            aggregator.fit(
                [self.real_anomalies, self.mts_probabilistic],
                [self.mts_anomalies1, self.mts_anomalies1],
            )

        # input an element that is not a anomalies
        with pytest.raises(ValueError):
            aggregator.fit("random", self.mts_anomalies1)
        with pytest.raises(ValueError):
            aggregator.fit(
                [self.real_anomalies, "random"],
                [self.mts_anomalies1, self.mts_anomalies1],
            )
        with pytest.raises(ValueError):
            aggregator.fit(
                [self.real_anomalies, 1], [self.mts_anomalies1, self.mts_anomalies1]
            )

        # nbr of anomalies must match nbr of input series
        with pytest.raises(ValueError):
            aggregator.fit(
                [self.real_anomalies, self.real_anomalies], self.mts_anomalies1
            )
        with pytest.raises(ValueError):
            aggregator.fit(
                [self.real_anomalies, self.real_anomalies], [self.mts_anomalies1]
            )
        with pytest.raises(ValueError):
            aggregator.fit(
                [self.real_anomalies], [self.mts_anomalies1, self.mts_anomalies1]
            )
Check that exception is raised when fit() arguments are incorrects
darts/tests/ad/test_aggregators.py