docstr: We show deprecation warnings when using `@st.experimental_singleton`, but not `@st.cache_resource`.
code: def test_deprecation_warnings(
      self,
      _,
      decorator: Any,
      should_show_warning: bool,
      show_warning_mock: Mock,
  ):
      """We show deprecation warnings when using `@st.experimental_singleton`, but not `@st.cache_resource`."""
      warning_str = (
          "`st.experimental_singleton` is deprecated. Please use the new command `st.cache_resource` instead, "
          "which has the same behavior. More information [in our docs](https://docs.streamlit.io/library/advanced-features/caching)."
      )
  
      # We show the deprecation warning at declaration time:
      @decorator
      def foo():
          return 42
  
      if should_show_warning:
          show_warning_mock.assert_called_once_with(warning_str)
      else:
          show_warning_mock.assert_not_called()
  
      # And also when clearing the cache:
      show_warning_mock.reset_mock()
      decorator.clear()
  
      if should_show_warning:
          show_warning_mock.assert_called_once_with(warning_str)
      else:
          show_warning_mock.assert_not_called()
  
imports: import threading
  import unittest
  from typing import Any, List
  from unittest.mock import Mock, patch
  from parameterized import parameterized
  import streamlit
  from streamlit.runtime.caching import cache_resource_api, get_resource_cache_stats_provider
  from streamlit.runtime.caching.cache_type import CacheType
  from streamlit.runtime.caching.cached_message_replay import MultiCacheResults
  from streamlit.runtime.caching.hashing import UserHashError
  from streamlit.runtime.scriptrunner import add_script_run_ctx
  from streamlit.runtime.stats import CacheStat
  from streamlit.vendor.pympler.asizeof import asizeof
  from tests.streamlit.runtime.caching.common_cache_test import as_cached_result
  from tests.testutil import create_mock_script_run_ctx
label_desc: Use image node_id 5 for calling the CacheResourceTest obj's underlying member method code with example usage: obj.test_deprecation_warnings(_, decorator, should_show_warning, show_warning_mock) and returns: int