class_docstr: Base class for async streamlit.server testing.
  
  Subclasses should patch 'streamlit.server.server.AppSession',
  to prevent AppSessions from being created, and scripts from
  being run. (Script running involves creating new threads, which
  interfere with other tests if not properly terminated.)
  
  See the "ServerTest" class for example usage.
class_docstr_tok: ["Base","class","for","async","streamlit.server","testing",".","Subclasses","should","patch","'streamlit.server.server.AppSession","'",",","to","prevent","AppSessions","from","being","created",",","and","scripts","from","being","run",".","(","Script","running","involves","creating","new","threads",",","which","interfere","with","other","tests","if","not","properly","terminated",".",")","See","the","``","ServerTest","''","class","for","example","usage","."]
docstr: Mock the Server's AppSession import. We don't want
  actual sessions to be instantiated, or scripts to be run.
docstr_tok: ["Mock","the","Server","'s","AppSession","import",".","We","do","n't","want","actual","sessions","to","be","instantiated",",","or","scripts","to","be","run","."]
code: def _patch_app_session(self):
      """Mock the Server's AppSession import. We don't want
      actual sessions to be instantiated, or scripts to be run.
      """
  
      return mock.patch(
          "streamlit.runtime.websocket_session_manager.AppSession",
          # new_callable must return a function, not an object, or else
          # there will only be a single AppSession mock. Hence the lambda.
          new_callable=lambda: self._create_mock_app_session,
      )
  
file_path: streamlit/lib/tests/streamlit/web/server/server_test_case.py
imports: import urllib.parse
  from unittest import mock
  import tornado.testing
  import tornado.web
  import tornado.websocket
  from tornado.websocket import WebSocketClientConnection
  from streamlit.proto.ForwardMsg_pb2 import ForwardMsg
  from streamlit.runtime import Runtime
  from streamlit.runtime.app_session import AppSession
  from streamlit.web.server import Server
label_desc: Use image node_id 5 for calling the ServerTestCase obj's underlying member method code with example usage: obj._patch_app_session() and returns: mock