code: def test_is_singleton():
      """The AppStateWatcher is a singleton for efficiency reasons.
  
      Its key that __new__ and __init__ of AppStateWatcher is only called once. See
      https://github.com/holoviz/param/issues/643
  
      """
      # When
      app1 = AppStateWatcher()
      name1 = app1.name
      state1 = app1.state
  
      app2 = AppStateWatcher()
      name2 = app2.name
      state2 = app2.state
  
      # Then
      assert app1 is app2
      assert name1 == name2
      assert app1.name == name2
      assert state1 is state2
      assert app1.state is state2
  
file_path: pytorch-lightning/tests/tests_app/frontend/panel/test_app_state_watcher.py
imports: import os
  from unittest import mock
  import pytest
  from lightning.app.frontend.panel.app_state_watcher import AppStateWatcher
  from lightning.app.utilities.state import AppState
  from lightning_utilities.core.imports import RequirementCache
label_desc: Use image node_id 4 for calling a global function with example usage: test_is_singleton() without return types