code: def test_persist_ad():
      model = PersistAD(window=1)
      s_train = s.copy().iloc[:-10]
      model.fit(s_train)
  
      s_test = s.copy().iloc[-2:]
      s_test.iloc[-1] = 10
      pd.testing.assert_series_equal(
          model.predict(s_test),
          pd.Series([np.nan, 1.0], index=s_test.index),
      )
  
      s_test = s.copy().iloc[-1:]
      s_test.iloc[-1] = 10
      pd.testing.assert_series_equal(
          model.predict(s_test), pd.Series([np.nan], index=s_test.index)
      )
  
      model = PersistAD(window=5)
      s_train = s.copy().iloc[:-10]
      model.fit(s_train)
  
      s_test = s.copy().iloc[-5:]
      s_test.iloc[-1] = 10
      pd.testing.assert_series_equal(
          model.predict(s_test),
          pd.Series([np.nan] * 5, index=s_test.index),
      )
  
      s_test = s.copy().iloc[-6:]
      s_test.iloc[-1] = 10
      pd.testing.assert_series_equal(
          model.predict(s_test),
          pd.Series([np.nan] * 5 + [1.0], index=s_test.index),
      )
  
imports: import numpy
  import pandas
  from adtk.detector import AutoregressionAD, LevelShiftAD, PersistAD, VolatilityShiftAD
label_desc: Use image node_id 1 for calling a global function with example usage: test_persist_ad() without return types