code: def test_attach_plugin():
      """Test how plugins get attached to the AppState and the default behavior when no plugin is specified."""
      app_state = AppState()
      assert isinstance(app_state._plugin, AppStatePlugin)
  
      app_state = AppState(plugin=_CustomAppStatePlugin())
      assert isinstance(app_state._plugin, _CustomAppStatePlugin)
  
imports: import os
  from re import escape
  from unittest import mock
  import lightning.app
  import pytest
  import requests
  from lightning.app import LightningApp, LightningFlow, LightningWork
  from lightning.app.structures import Dict, List
  from lightning.app.utilities.app_helpers import AppStatePlugin, BaseStatePlugin
  from lightning.app.utilities.state import AppState
  from lightning_cloud.openapi import Externalv1LightningappInstance, V1LightningappInstanceStatus
label_desc: Use image node_id 7 for calling a global function with example usage: test_attach_plugin() without return types