code: def test_fit_detect(testCase):
      """Test fit_detect the detector."""
      df = pd.DataFrame(
          np.array(testCase["df"]).T,
          pd.date_range(
              start="2017-1-1", periods=len(testCase["df"][0]), freq="D"
          ),
      )
      model = testCase["model"](**testCase["params"])
      a_true = pd.Series(testCase["a"], index=df.index)
      if isinstance(model, _TrainableModel):
          a = model.fit_detect(df)
      else:
          a = model.detect(df)
      pd.testing.assert_series_equal(a, a_true, check_dtype=False)
      if a_true.sum() == 0:
          assert isnan(model.score(df, a_true, scoring="recall"))
      else:
          assert model.score(df, a_true, scoring="precision") == 1
  
file_path: adtk/tests/test_detectorhd.py
imports: from math import isnan
  import numpy
  import pandas
  import pytest
  from sklearn.cluster import KMeans
  from sklearn.ensemble import IsolationForest
  from sklearn.linear_model import LinearRegression
  from sklearn.neighbors import LocalOutlierFactor
  import adtk.detector
  from adtk._base import _TrainableModel
label_desc: Use image node_id 1 for calling a global function with example usage: test_fit_detect(testCase) without return types