code: def test_ad_config_from_dict():
      """Tests `from_dict` method of `ADConfig`."""
      for param in [
          AD_CONFIG_JSON_DEFAULT,
          AD_CONFIG_JSON_PARTIAL,
          AD_CONFIG_JSON_COMPLETE,
      ]:
          ad_config = param.get("ad_config")
          ad_json = param.get("ad_json")
          ad_dict = json.loads(ad_json)
          translated_ad_config = ADConfig.from_dict(ad_dict)
          assert_equal_ad_config(ad_config, translated_ad_config)
  
      # Raises error when input is not a dictionary
      with pytest.raises(ValueError, match="not a dictionary"):
          ADConfig.from_dict(5)
  
file_path: greykite/greykite/tests/detection/detector/test_config.py
imports: import json
  import pytest
  from greykite.detection.detector.config import ADConfig
  from greykite.detection.detector.config import assert_equal_ad_config
  from greykite.detection.detector.config_utils import AD_CONFIG_JSON_COMPLETE
  from greykite.detection.detector.config_utils import AD_CONFIG_JSON_DEFAULT
  from greykite.detection.detector.config_utils import AD_CONFIG_JSON_PARTIAL
label_desc: Use image node_id 3 for calling a global function with example usage: test_ad_config_from_dict() without return types