code: def test_WassersteinScorer(self):
      # component_wise parameter
      # component_wise must be bool
      with pytest.raises(ValueError):
          WassersteinScorer(component_wise=1)
      with pytest.raises(ValueError):
          WassersteinScorer(component_wise="string")
      # if component_wise=False must always return a univariate anomaly score
      scorer = WassersteinScorer(component_wise=False)
      scorer.fit(self.train)
      assert scorer.score(self.test).width == 1
      scorer.fit(self.mts_train)
      assert scorer.score(self.mts_test).width == 1
      # if component_wise=True must always return the same width as the input
      scorer = WassersteinScorer(component_wise=True)
      scorer.fit(self.train)
      assert scorer.score(self.test).width == 1
      scorer.fit(self.mts_train)
      assert scorer.score(self.mts_test).width == self.mts_test.width
  
      # window parameter
      # window must be int
      with pytest.raises(ValueError):
          WassersteinScorer(window=True)
      with pytest.raises(ValueError):
          WassersteinScorer(window="string")
      # window must be non negative
      with pytest.raises(ValueError):
          WassersteinScorer(window=-1)
      # window must be different from 0
      with pytest.raises(ValueError):
          WassersteinScorer(window=0)
  
      # diff_fn paramter
      # must be None, 'diff' or 'abs_diff'
      with pytest.raises(ValueError):
          WassersteinScorer(diff_fn="random")
      with pytest.raises(ValueError):
          WassersteinScorer(diff_fn=1)
  
      # test _diff_series() directly
      with pytest.raises(ValueError):
          s_tmp = WassersteinScorer()
          s_tmp.diff_fn = "random"
          s_tmp._diff_series(self.train, self.test)
      WassersteinScorer(diff_fn="diff")._diff_series(
          self.train, self.test
      )
      WassersteinScorer()._diff_series(self.train, self.test)
  
      scorer = WassersteinScorer()
  
      # always expects a deterministic input
      with pytest.raises(ValueError):
          scorer.score_from_prediction(self.train, self.probabilistic)
      with pytest.raises(ValueError):
          scorer.score_from_prediction(self.probabilistic, self.train)
      with pytest.raises(ValueError):
          scorer.score(self.probabilistic)
  
      # window must be smaller than the input of score()
      scorer = WassersteinScorer(window=101)
      with pytest.raises(ValueError):
          scorer.fit(self.train)  # len(self.train)=100
  
      scorer = WassersteinScorer(window=80)
      scorer.fit(self.train)
      with pytest.raises(ValueError):
          scorer.score(self.test[:50])  # len(self.test)=100
  
      # test plotting (just call the functions)
      scorer = WassersteinScorer(window=2)
      scorer.fit(self.train)
      scorer.show_anomalies(self.test, self.anomalies)
      with pytest.raises(ValueError):
          # should fail for a sequence of series
          scorer.show_anomalies([self.test, self.test], self.anomalies)
      scorer.show_anomalies_from_prediction(
          actual_series=self.test,
          pred_series=self.test + 1,
          actual_anomalies=self.anomalies,
      )
      with pytest.raises(ValueError):
          # should fail for a sequence of series
          scorer.show_anomalies_from_prediction(
              actual_series=[self.test, self.test],
              pred_series=self.test + 1,
              actual_anomalies=self.anomalies,
          )
      with pytest.raises(ValueError):
          # should fail for a sequence of series
          scorer.show_anomalies_from_prediction(
              actual_series=self.test,
              pred_series=[self.test + 1, self.test + 2],
              actual_anomalies=self.anomalies,
          )
  
      assert not scorer.is_probabilistic
  
imports: from typing import Sequence
  import numpy
  import pytest
  import sklearn
  from pyod.models.knn import KNN
  from scipy.stats import cauchy, expon, gamma, laplace, norm, poisson
  from darts import TimeSeries
  from darts.ad.scorers import CauchyNLLScorer
  from darts.ad.scorers import DifferenceScorer
  from darts.ad.scorers import ExponentialNLLScorer, GammaNLLScorer, GaussianNLLScorer, KMeansScorer, LaplaceNLLScorer
  from darts.ad.scorers import NormScorer
  from darts.ad.scorers import PoissonNLLScorer, PyODScorer, WassersteinScorer
  from darts.models import MovingAverageFilter
label_desc: Use image node_id 8 for calling the TestADAnomalyScorer obj's underlying member method code with example usage: obj.test_WassersteinScorer() without return types