code: def test_AnomalyDetectorAnalysis(monkeypatch):
      call_create_detector = MagicMock()
      call_create_detector.fit_transform.side_effect = lambda x: {
          "train_data_df": "train_df_score",
      }[x]
  
      call_create_detector.transform.side_effect = lambda x: {
          "test_data_df": "test_df_score",
          "val_data_df": "val_df_score",
      }[x]
  
      with monkeypatch.context() as m:
          m.setattr(
              AnomalyDetectorAnalysis,
              "_create_detector",
              lambda *args: call_create_detector,
          )
          ad = AnomalyDetectorAnalysis(
              train_data="train_data_df",
              test_data="test_data_df",
              val_data="val_data_df",
              label="label",
              n_folds=3,
          )
          ad.can_handle = MagicMock(return_value=True)
          state = ad.fit()
  
      assert state == {
          "anomaly_detection": {
              "scores": {
                  "test_data": "test_df_score",
                  "train_data": "train_df_score",
                  "val_data": "val_df_score",
              }
          }
      }
  
file_path: autogluon/eda/tests/unittests/analysis/test_anomaly.py
imports: from unittest.mock import MagicMock
  import numpy
  import pandas
  import pytest
  from pandas.testing import assert_frame_equal
  from pyod.models.lof import LOF
  from autogluon.eda import AnalysisState
  from autogluon.eda.analysis import AnomalyDetector, AnomalyDetectorAnalysis
label_desc: Use image node_id 4 for calling a global function with example usage: test_AnomalyDetectorAnalysis(monkeypatch) without return types