code: def test_fit_detect(testCase):
      """Test fit_detect the detector."""
      s = pd.Series(
          testCase["s"],
          pd.date_range(
              start="2017-1-1", periods=len(testCase["s"]), freq="D"
          ),
      )
      model = testCase["model"](**testCase["params"])
      a_true = pd.Series(testCase["a"], index=s.index)
      if testCase["pandas_bug"] and (
          parse(pd.__version__) < parse("0.25")
      ):
          with pytest.raises(PandasBugError):
              a = model.fit_detect(s)
      else:
          if isinstance(model, _TrainableModel):
              a = model.fit_detect(s)
          else:
              a = model.detect(s)
          pd.testing.assert_series_equal(a, a_true, check_dtype=False)
          if a_true.sum() == 0:
              assert isnan(model.score(s, a_true, scoring="recall"))
          else:
              assert model.score(s, a_true, scoring="precision") == 1
  
file_path: adtk/tests/test_detector1d.py
imports: from math import isnan
  import numpy
  import pandas
  import pytest
  from packaging.version import parse
  from sklearn.svm import SVR
  import adtk.detector
  from adtk._base import _TrainableModel
  from adtk._utils import PandasBugError
label_desc: Use image node_id 1 for calling a global function with example usage: test_fit_detect(testCase) without return types