code: def test_FittableAggregator(self):
      for aggregator in list_FittableAggregator:
          # name must be of type str
          assert type(aggregator.__str__()) == str
  
          # Need to call fit() before calling predict()
          with pytest.raises(ValueError):
              aggregator.predict(
                  [self.mts_anomalies1, self.mts_anomalies1]
              )
  
          # Check if trainable is True, being a FittableAggregator
          assert aggregator.trainable
  
          # Check if _fit_called is False
          assert not aggregator._fit_called
  
          # 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],
              )
  
          # case1: fit
          aggregator.fit(self.real_anomalies, self.mts_anomalies1)
  
          # Check if _fit_called is True after being fitted
          assert aggregator._fit_called
  
          # series must be same width as series used for training
          with pytest.raises(ValueError):
              aggregator.predict(self.mts_anomalies3)
          with pytest.raises(ValueError):
              aggregator.predict([self.mts_anomalies3])
          with pytest.raises(ValueError):
              aggregator.predict(
                  [self.mts_anomalies1, self.mts_anomalies3]
              )
  
          # predict on (sequence of) univariate series
          with pytest.raises(ValueError):
              aggregator.predict([self.real_anomalies])
          with pytest.raises(ValueError):
              aggregator.predict(self.real_anomalies)
          with pytest.raises(ValueError):
              aggregator.predict(
                  [self.mts_anomalies1, self.real_anomalies]
              )
  
          # input a (sequence of) non binary series
          with pytest.raises(ValueError):
              aggregator.predict(self.mts_train)
          with pytest.raises(ValueError):
              aggregator.predict([self.mts_anomalies1, self.mts_train])
  
          # input a (sequence of) probabilistic series
          with pytest.raises(ValueError):
              aggregator.predict(self.mts_probabilistic)
          with pytest.raises(ValueError):
              aggregator.predict(
                  [self.mts_anomalies1, self.mts_probabilistic]
              )
  
          # input an element that is not a series
          with pytest.raises(ValueError):
              aggregator.predict([self.mts_anomalies1, "random"])
          with pytest.raises(ValueError):
              aggregator.predict([self.mts_anomalies1, 1])
  
          # Check width return
          # Check if return type is the same number of series in input
          assert len(
              aggregator.eval_accuracy(
                  [self.real_anomalies, self.real_anomalies],
                  [self.mts_anomalies1, self.mts_anomalies2],
              )
          ), len([self.mts_anomalies1, self.mts_anomalies2])
  
file_path: darts/darts/tests/ad/test_aggregators.py
imports: from typing import Sequence
  import numpy
  import pytest
  from sklearn.ensemble import GradientBoostingClassifier
  from darts import TimeSeries
  from darts.ad.aggregators.and_aggregator import AndAggregator
  from darts.ad.aggregators.ensemble_sklearn_aggregator import EnsembleSklearnAggregator
  from darts.ad.aggregators.or_aggregator import OrAggregator
  from darts.models import MovingAverageFilter
label_desc: Use image node_id 5 for calling the TestADAggregators obj's underlying member method code with example usage: obj.test_FittableAggregator() without return types