code: def test_remove_refs_for_session(self):
      cache = ForwardMsgCache()
  
      session1 = _create_mock_session()
      session2 = _create_mock_session()
  
      # Only session1 has a ref to msg1.
      msg1 = create_dataframe_msg([1, 2, 3])
      populate_hash_if_needed(msg1)
      cache.add_message(msg1, session1, 0)
  
      # Only session2 has a ref to msg2.
      msg2 = create_dataframe_msg([1, 2, 3, 4])
      populate_hash_if_needed(msg2)
      cache.add_message(msg2, session2, 0)
  
      # Both session1 and session2 have a ref to msg3.
      msg3 = create_dataframe_msg([1, 2, 3, 4, 5])
      populate_hash_if_needed(msg2)
      cache.add_message(msg3, session1, 0)
      cache.add_message(msg3, session2, 0)
  
      cache.remove_refs_for_session(session1)
  
      cache_entries = list(cache._entries.values())
  
      cached_msgs = [entry.msg for entry in cache_entries]
      assert cached_msgs == [msg2, msg3]
  
      sessions_with_refs = {
          s
          for entry in cache_entries
          for s in entry._session_script_run_counts.keys()
      }
      assert sessions_with_refs == {session2}
  
imports: import unittest
  from unittest.mock import MagicMock
  from streamlit import config
  from streamlit.runtime import app_session
  from streamlit.runtime.forward_msg_cache import ForwardMsgCache, create_reference_msg, populate_hash_if_needed
  from streamlit.runtime.stats import CacheStat
  from streamlit.testing.v1.util import patch_config_options
  from tests.streamlit.message_mocks import create_dataframe_msg
label_desc: Use image node_id 7 for calling the ForwardMsgCacheTest obj's underlying member method code with example usage: obj.test_remove_refs_for_session() without return types