code: def test_disconnect_and_reconnect_session(self):
      session_id = self.connect_session()
      original_session_info = self.session_mgr.get_session_info(
          session_id
      )
      original_client = original_session_info.client
  
      # File watchers are registered on AppSession creation.
      original_session_info.session.register_file_watchers.assert_called_once()
  
      self.session_mgr.disconnect_session(session_id)
  
      assert (
          session_id not in self.session_mgr._active_session_info_by_id
      )
      assert session_id in self.session_mgr._session_storage._cache
      original_session_info.session.disconnect_file_watchers.assert_called_once()
      original_session_info.session.request_script_stop.assert_called_once()
  
      # Call disconnect_session again to verify that disconnect_session is idempotent.
      self.session_mgr.disconnect_session(session_id)
  
      assert (
          session_id not in self.session_mgr._active_session_info_by_id
      )
      assert session_id in self.session_mgr._session_storage._cache
      original_session_info.session.disconnect_file_watchers.assert_called_once()
      original_session_info.session.request_script_stop.assert_called_once()
  
      # Reconnect to the existing session.
      reconnected_session_id = self.connect_session(
          existing_session_id=session_id
      )
      reconnected_session_info = self.session_mgr.get_session_info(
          reconnected_session_id
      )
  
      assert reconnected_session_id == session_id
      assert (
          reconnected_session_info.session
          == original_session_info.session
      )
      assert reconnected_session_info != original_session_info
      assert reconnected_session_info.client != original_client
      # File watchers are registered on AppSession creation and again on AppSession
      # reconnect.
      assert (
          reconnected_session_info.session.register_file_watchers.call_count
          == 2
      )
  
imports: import unittest
  from unittest.mock import MagicMock, patch
  import pytest
  from streamlit.runtime.script_data import ScriptData
  from streamlit.runtime.session_manager import SessionStorage
  from streamlit.runtime.websocket_session_manager import WebsocketSessionManager
label_desc: Use image node_id 9 for calling the WebsocketSessionManagerTests obj's underlying member method code with example usage: obj.test_disconnect_and_reconnect_session() without return types